File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes filter mapping Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "filter mapping" Watch "filter mapping" New topic

filter mapping

Manju Devarla
Ranch Hand

Joined: Dec 14, 2006
Posts: 85
Can any one explain me about this..

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



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

Joined: Apr 01, 2007
Posts: 58
The rule of filter chain is to loop through URL pattern matching first, it invokes the one matches; then the servlet matching.
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

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.

[My Blog]
All roads lead to JavaRanch
Anupama Ponnapalli
Ranch Hand

Joined: Jun 12, 2006
Posts: 66
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.
I agree. Here's the link:
subject: filter mapping
It's not a secret anymore!