该接口的void doFilter(ServletRequest request, ServletResponse response)
Causes the next filter in the chain to be invoked, or if the calling filter is the last filter in the chain, causes the resource at the end of the chain to be invoked.用于调用过滤器链中的下一个过滤器,如果这个过滤器是链上的最后一个过滤器,则将请求交给处理程序或将响应发给客户端。
A filter configuration object used by a servlet container to pass information to a filter during initialization。用于读取web.xml文件中的Servlet过滤器的初始化参数,在过滤器初始化阶段提供过滤器名、初始化参数和Servlet上行文等信息。
该接口提供了以下的java.lang.String getFilterName()、java.lang.String getInitParameter(java.lang.String name)、ServletContext getServletContext()和ServletContext getServletContext()四个方法:
java.lang.String getFilterName()
Returns the filter-name of this filter as defined in the deployment descriptor.
java.lang.String getInitParameter(java.lang.String name)
Returns a String containing the value of the named initialization parameter, or null if the initialization parameter does not exist.
java.util.Enumeration<java.lang.String> getInitParameterNames()
Returns the names of the filter's initialization parameters as an Enumeration of String objects, or an empty Enumeration if the filter has no initialization parameters.
ServletContext getServletContext()
Returns a reference to the ServletContext in which the caller is executing. 返回调用者所处的Servlet上下文。
过滤器小结
1.一个Servlet过滤器可以有多个映射(这个过滤器指定多个URL规则。)
2.反过来一个URL可对应多个Servlet过滤器,这些过滤器根据在配置文件中出现的先后顺序组成一个过滤器链。
session、Cookie、URL重写和隐藏表单域
与Java中的器类,只不过Servlet器的web组件。Servlet共提供8个端口和6个事件类,分别实现了对Servlet上下文、HTTP会话和客户端请求的。
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/ruanjian/article-36808-20.html
弄个破渔网让它拖着不是很好么
不知道怎么火的
央视报告什么都挨骂
加你妹丫
说出些猪狗不如的屁话