Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt with matching of filter chains

 
Jas Oberai
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Friends,
I got a question regarding matching of filter-patters.One of the statements in HFSJ states:


Can somebody show me an example that demonstrates this statement.

And moreover,I couldn't understand how the filter chain mapiing works,say i have 4 filters saving these urls:



Now,as per my understanding after reading the book is that if somebody requests "test.jsp",the order the filter chains would execute are:


But my doubt is why not:


Because i think thats the way how <url-pattern> in servlet-mapping works.Please correct me if I am wrong.

Thanks
 
Chinu Hota
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you are right. The answer given is not right. But the answer you are saying, that's probably also not right. It should be F1, F2 and then F3
 
Raghusham Sankargal
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

The order of filters is like below.

First it will see the <url-pattern> tag for matching and then it looks for <servlet-name> tag. That is why the confusion about the order. Plese check what is the tag used for F1, F2, F3, F4. Correct me if I am wrong.
 
Jas Oberai
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am little confused..so do you mean that part in the book is wrong??Author's or previous exam takers can somebody please clear this confusion,I have my exam this wednesday.
 
vidya sagar
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

But my doubt is why not:
F2,F1 and F3


Because server first looks on all url-pattern stuff, once it will finished, then only it start to looks for any servlet name(if any).

But F3 is based on url-pattern so it should come before any servlet name matching(i.e before F2)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic