Original source: http://blog.csdn.net/weizhi/article/details/1895014
The order in which multiple filter runs in Web. xml
Walker ([email protected]) 2007-11-20
Environment: Tomcat 6.x
The order in which multiple filters are run depends on the following rules:
1. filter-mapping
add elements to the chain in the url-pattern
order in which they appear in the deployment descriptor by including the filters that match the request. web.xml
2. filter-mapping
Add the element that contains the filter that matches the request servlet-name
after the filter that matches the URL pattern in the chain.
3. In-line first-out, the last item in the chain is often the originally requested resource.
Other words:
1. The filter runtime configured in Url-pattern must precede the filter configured in the Servlet-name mode
2. In the filter configured in Url-partern, if there are multiple matches to the current request, it is run in the order in which filter-mapping appears in Web. xml
3. For a filter configured in Servlet-name mode, if there are multiple matches to the current request, it is also run in the order in which filter-mapping appears in Web. xml