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.
Question:
Here we need to determine the sequence for every request path.
I answered:____________________Correct Answer
1-5____________________ 1-5
1-2-5__________________ 1-5-2
1-4-5__________________1-5-4
5_____________________ 5
1-3-5__________________1-3-5
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?