多个Filter 的执行顺序
2012-07-13 17:18
246 查看
如果在WEB.XML中有多个Filter,则执行顺序为
<filter-mapping>的顺序
<filter-mapping>
<filter-name>secondFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>sysoutFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
执行顺序为 secondFilter, sysoutFilter
Filters where the
Filters where the
after the filters that match a URL pattern.
The last item in the chain is always the originally requested resource.
In your filter class, use the
<filter-mapping>的顺序
<filter-mapping>
<filter-name>secondFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>sysoutFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
执行顺序为 secondFilter, sysoutFilter
Configuring a Chain of Filters
WebLogic Server creates a chain of filters by creating a list of all the filter mappings that match an incoming HTTP request. The ordering of the list is determined by the following sequence:Filters where the
filter-mappingelement contains a
url-patternthat matches the request are added to the chain in the order they appear in the
web.xmldeployment descriptor.
Filters where the
filter-mappingelement contains a
servlet-namethat matches the request are added to the chain
after the filters that match a URL pattern.
The last item in the chain is always the originally requested resource.
In your filter class, use the
FilterChain.doFilter()method to invoke the next item in the chain.
相关文章推荐
- WEB API 系列(二) Filter的使用以及执行顺序
- filter、servlet、interceptor的执行顺序
- Asp.net Mvc Framework 七 (Filter及其执行顺序)
- WEB API 系列(二) Filter的使用以及执行顺序
- Filter、Servlet和Interceptor的执行顺序
- 关于Filter执行顺序的探究
- Servlet 3.0 之@WebFilter怎么控制多个filter的执行顺序
- JavaWeb Filter 的执行顺序
- ASP.NET MVC Filter (过滤器)的执行顺序
- Tomcat的valve、filter和servlet的执行顺序
- @WebFilter怎么控制多个filter的执行顺序
- filter和拦截器的区别和执行顺序
- 基于注解方式的Filter执行顺序
- javaWEB总结(29):理解多个Filter代码的执行顺序
- Filter介绍,执行顺序,实例
- 转:Filter的执行顺序与实例
- Filter介绍,执行顺序,实例
- Filter介绍,执行顺序,实例
- [原创]java WEB学习笔记45:自定义HttpFilter类,理解多个Filter 代码的执行顺序,Filterdemo:禁用浏览器缓存的Filter,字符编码的Filter,检查用户是否登陆过的Filter
- Servlet中filter的执行顺序以及urlPatterns和servletNames之间的关系