public class EncasedFilters extends Object implements javax.servlet.Filter
This allows you to include multiple filters into your web.xml by including a single filter. You can provide recommended filter combinations as a single filter, too.
The filter
public class MyEncasedFilters extends EncasedFilters { public MyEncasedFilters() { super(MyFirstFilter(), MySecondFilter()); } }
<filter> <filter-name>MyEncasedFilters</filter-name> <filter-class>my.package.MyEncasedFilters</filter-class> </filter> <filter-mapping> <filter-name>MyEncasedFilters</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
is a replacement for
<filter> <filter-name>MyFirstFilter</filter-name> <filter-class>my.package.MyFirstFilter</filter-class> </filter> <filter> <filter-name>MySecondFilter</filter-name> <filter-class>my.package.MySecondFilter</filter-class> </filter> <filter-mapping> <filter-name>MyFirstFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>MySecondFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
Constructor and Description |
---|
EncasedFilters(javax.servlet.Filter... filters) |
Modifier and Type | Method and Description |
---|---|
void |
destroy() |
void |
doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain filterChain) |
void |
init(javax.servlet.FilterConfig filterConfig) |
public void init(javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException
init
in interface javax.servlet.Filter
javax.servlet.ServletException
public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain filterChain) throws IOException, javax.servlet.ServletException
doFilter
in interface javax.servlet.Filter
IOException
javax.servlet.ServletException
public void destroy()
destroy
in interface javax.servlet.Filter
Copyright © 2014–2015. All rights reserved.