Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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

A question about filtr order

 
avseq anthoy
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The HFSJ P678.It says that filters with matching URL patterns are placed in chain in the order in which they are declared in DD.

But in P680,
/Recipes/HopsList.do --> 1,5,2
Recipes/Modify/ModRecipes.do --> 1,5,4

The ansers did't follow the sequence declared in DD.
But why?


thx for your replying!
 
Esam Ahmed
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi avseq,

I had little problem with this one too...
I overlooked the <servlet-name> element within this problem...

Here is a link that had this same problem solved...

http://www.coderanch.com/t/169681/java-Web-Component-SCWCD/certification/Filter-HF-Book
Let me know if it's clear or not ?

Here is the tricky part:
You probably overlooked....

You need to consider both <url-pattern> and <servlet-name>

Even though both <url-pattern> and <servlet-name> are declared with the <filter-mapping>

The container will honor the <url-pattern> first (in the order thery are declared) then they will honor the <servlet-name> in the order they are declared in the <filter-mapping> declaration.

It wouldn't just follow the declaration order, it must also distinguish between <url-pattern> and <servlet-name> if both of these elements are present for a request..

Should be clear now...

Esam

[ September 18, 2005: Message edited by: Esam Ahmed ]
[ September 18, 2005: Message edited by: Esam Ahmed ]
 
avseq anthoy
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your replying.I can understand now!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic