• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

filter mapping

 
Manju Devarla
Ranch Hand
Posts: 85
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
 
Grace Yang
Ranch Hand
Posts: 58
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The rule of filter chain is to loop through URL pattern matching first, it invokes the one matches; then the servlet matching.
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Anupama Ponnapalli
Ranch Hand
Posts: 66
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic