The order in which multiple filter runs in Web. xml

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.