A filter is an object that performs filtering tasks on either the request to a resource (a servlet or static content), or on the response from a resource, or both.
(过滤器是一个对象,它对资源(servlet或静态内容)的请求执行过滤任务,或对资源的响应,或两者都执行过滤任务。)
Filters perform filtering in the doFilter
method. Every Filter has access to a FilterConfig object from which it can obtain its initialization parameters, and a reference to the ServletContext which it can use, for example, to load resources needed for filtering tasks.
(滤波器采用doFilter方法 执行过滤。每个过滤器访问FilterConfig 对象获得它的初始化参数,并参考ServletContext它可以使用,例如,加载过滤任务所需要的资源。)
Filters are configured in the deployment descriptor of a web application.
(过滤器配置在Web应用程序的部署描述符中。)
Examples that have been identified for this design are:
- Authentication Filters ----身份认证过滤
- Logging and Auditing Filters ---日志和认证过滤
- Image conversion Filters ----图像转换过滤器
- Data compression Filters --数据压缩过滤器
- Encryption Filters ---加密过滤
- Tokenizing Filters
- Filters that trigger resource access events----触发资源访问事件的过滤器
- XSL/T filters
- Mime-type chain Filter MIME型链过滤器