Class
FilterChainProxyjava.lang.Objectorg.acegisecurity.util.FilterChainProxy
- All Implemented Interfaces:
- Filter, InitializingBean, ApplicationContextAware
public class FilterChainProxy
- extends Object
- implements Filter, InitializingBean, ApplicationContextAware
Delegates Filter
requests to a list of Spring-managed beans.
通过一系列的由spring托管的beans ,代理过滤请求。
FilterChainProxy 通过在web.xml中定义的FilterToBeanProxy 被加载,FilterChainProxy 将会通过init(FilterConfig)
, destroy()
and doFilter(ServletRequest, ServletResponse, FilterChain)
调用,调用每一个在其中定义的过滤器。
The FilterChainProxy
is loaded via a standard FilterToBeanProxy
declaration in web.xml
. FilterChainProxy
will then pass init(FilterConfig)
, destroy()
and doFilter(ServletRequest, ServletResponse, FilterChain)
invocations through to each Filter
defined against FilterChainProxy
.
FilterChainProxy 是通过一个标准的FilterInvocationDefinitionSource 来实现配置的,每个可能的FilterChainProxy应该服务的URI模式都必须进入
第一个搭配的URI模式将会被用来定义处理请求的所有的过滤器,就是说只适配第一组过滤器,后面的其他过滤器将无效。
FilterChainProxy
is configured using a standard FilterInvocationDefinitionSource
. Each possible URI pattern that FilterChainProxy
should service must be entered. The first matching URI pattern located by FilterInvocationDefinitionSource
for a given request will be used to define all of the Filter
s that apply to that request. NB: This means you must put most specific URI patterns at the top of the list, and ensure all Filter
s that should apply for a given URI pattern are entered against the respective entry. The FilterChainProxy
will not iterate the remainder of the URI patterns to locate additional Filter
s. The FilterInvocationDefinitionSource
described the applicable URI pattern to fire the filter chain, followed by a list of configuration attributes. Each configuration attribute's ConfigAttribute.getAttribute()
corresponds to a bean name that is available from the application context.
FilterChainProxy
respects normal handling of Filter
s that elect not to call Filter.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain)
, in that the remainder of the origial or FilterChainProxy
-declared filter chain will not be called.
It is particularly noted the Filter
lifecycle mismatch between the servlet container and IoC container. As per FilterToBeanProxy
JavaDocs, we recommend you allow the IoC container to manage lifecycle instead of the servlet container. By default the FilterToBeanProxy
will never call this class' init(FilterConfig)
and destroy()
methods, meaning each of the filters defined against FilterInvocationDefinitionSource
will not be called. If you do need your filters to be initialized and destroyed, please set the lifecycle
initialization parameter against the FilterToBeanProxy
to specify servlet container lifecycle management.
If a filter name of TOKEN_NONE
is used, this allows specification of a filter pattern which should never cause any filters to fire.
大盘预测
国富论
posted on 2007-09-12 16:20
华梦行 阅读(1922)
评论(0) 编辑 收藏 所属分类:
Spring