This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have read below about filters in HFSJ Page # 710
IMPORTANT: The Container’s rules for ordering filters:
When more than one filter is mapped to a given resource, the Container uses the following rules:
1) ALL filters with matching URL patterns are located first. This is NOT the same as the URL mapping rules the Container uses to choose the “winner” when a client makes a request for a resource, because ALL filters that match will be placed in the chain!! Filters with matching URL patterns are placed in the chain in the order in which they are declared in the DD.
2) Once all filters with matching URLs are placed in the chain, the Container does the same thing with filters that have a matching <servlet-name> in the DD.
Based on that I tried to answer below question.
Here we need to determine the sequence for every request path.
Look carefully how the declaration for 1,5 differs from 2. 1 and 5 use the "url-pattern". 2 uses the "servlet-name". All matching "url-pattern" come before any matching "servlet-name". So, 2 cannot be called before 5. 1 and 5 are both "url-pattern", so they wil be called in the order they have been declared. So, 1 first, then 5. As a result, filters will be called in the following order : 1,5,2
Joined: Aug 16, 2007
Oh my Bad.... Now I got it ... I should have read the rules carefully. Sorry Christophe.