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.
I answered:____________________Correct Answer
Here, My answers differ for 2nd and 3rd request path.
Based on the above quote and my understanding I solve like this.
First see how many patterns match with filter pattern. Put them aside. Now only those filters will be called in order they are defined.
So what's wrong?
1,2 and 5 are matching Filter for 2nd request path. Now it should follow the order in which they are defined. And the order is Filter 1 Filter 2 and Filter 5.
Christophe Verré wrote:5 cannot be after 2, because all matching url-pattern come first.
Ain't I correct?