类 CompositeFilter
- java.lang.Object
- org.springframework.web.filter.CompositeFilter
- 所有已实现的接口:
Filter
public class CompositeFilter extends Object implements Filter
A generic composite servletFilter
that just delegates its behavior to a chain (list) of user-supplied filters, achieving the functionality of aFilterChain
, but conveniently using onlyFilter
instances.This is useful for filters that require dependency injection, and can therefore be set up in a Spring application context. Typically, this composite would be used in conjunction with
DelegatingFilterProxy
, so that it can be declared in Spring but applied to a servlet context.- 从以下版本开始:
- 3.1
- 作者:
- Dave Syer
构造器概要
构造器 构造器 说明 CompositeFilter()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
destroy()
Clean up all the filters supplied, calling each one's destroy method in turn, but in reverse order.void
doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
Forms a temporary chain from the list of delegate filters supplied (setFilters(java.util.List<? extends javax.servlet.Filter>)
) and executes them in order.void
init(FilterConfig config)
Initialize all the filters, calling each one's init method in turn in the order supplied.void
setFilters(List<? extends Filter> filters)
构造器详细资料
CompositeFilter
public CompositeFilter()
方法详细资料
setFilters
public void setFilters(List<? extends Filter> filters)
init
public void init(FilterConfig config) throws ServletException
Initialize all the filters, calling each one's init method in turn in the order supplied.- 指定者:
init
在接口中Filter
- 抛出:
ServletException
- 另请参阅:
Filter.init(FilterConfig)
doFilter
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
Forms a temporary chain from the list of delegate filters supplied (setFilters(java.util.List<? extends javax.servlet.Filter>)
) and executes them in order. Each filter delegates to the next one in the list, achieving the normal behavior of aFilterChain
, despite the fact that this is aFilter
.
destroy
public void destroy()
Clean up all the filters supplied, calling each one's destroy method in turn, but in reverse order.- 指定者:
destroy
在接口中Filter
- 另请参阅:
Filter.init(FilterConfig)