public class CompositeFilter extends java.lang.Object implements Filter
Filterthat just delegates its behavior to a chain (list) of user-supplied filters, achieving the functionality of a
FilterChain, but conveniently using only
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
so that it can be declared in Spring but applied to a servlet context.
|Constructor and Description|
|Modifier and Type||Method and Description|
Clean up all the filters supplied, calling each one's destroy method in turn, but in reverse order.
Forms a temporary chain from the list of delegate filters supplied (
Initialize all the filters, calling each one's init method in turn in the order supplied.
public void setFilters(java.util.List<? extends Filter> filters)
public void init(FilterConfig config) throws ServletException
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws java.io.IOException, ServletException
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 a
FilterChain, despite the fact that this is a
ServletRequestobject contains the client's request
ServletResponseobject contains the filter's response
FilterChainfor invoking the next filter or the resource
java.io.IOException- if an I/O related error has occurred during the processing
ServletException- if an exception occurs that interferes with the filter's normal operation
Filter.doFilter(ServletRequest, ServletResponse, FilterChain)