Forums Register Login

filter mapping

+Pie Number of slices to send: Send
Hi,
Can any one explain me about this..

Which of the statements is true about the following deployment descriptor snippet?

<filter-mapping>
<filter-name>Filter1</filter-name>
<servlet-name>ServletToFilter</servlet-name></filter-mapping><filter-mapping>

<filter-name>Filter2</filter-name>
<url-pattern>/*</url-pattern></filter-mapping>

How come the answer for the above question is " Filter2 will be invoked before Filter1 if ServletToFilter is requested"

Becuase filters are invoked the order in which they apper in DD right..
so it should be Filter..
+Pie Number of slices to send: Send
The rule of filter chain is to loop through URL pattern matching first, it invokes the one matches; then the servlet matching.
+Pie Number of slices to send: Send
 

Becuase filters are invoked the order in which they apper in DD right..


Nope. As Grace pointed out, URL matching takes priority before Name matching.
+Pie Number of slices to send: Send
Satou is right.

Filter Chaining Rules:

1. All filters with matching URL patterns are located. They are executed in the order of declaration in the DD.
2. After this, all the filters with the matching servlet-name in the DD are located and executed in the order of declaration.
Are you okay? You look a little big. Maybe this tiny ad will help:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 882 times.
Similar Threads
Question about Filter trigger sequence
Filters chain
filter-mapping doubt??
order of filter mapping
Servlet Filter chain construction order
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 06:21:29.