This week's giveaways are in the MongoDB and Jobs Discussion forums.
We're giving away four copies of Mongo DB Applied Patterns and 4 resume reviews from Five Year Itch and have the authors/reps on-line!
See this thread and this one for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Filter Mapping Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Reply Bookmark "Filter Mapping" Watch "Filter Mapping" New topic
Author

Filter Mapping

Srividhya Kiran
Ranch Hand

Joined: Feb 17, 2008
Posts: 166
Hello ranchers

Consider this code I have taken this from HFSJ chapter 13 pg no:695.


Request path Filter Sequence
Case 1: /Recipes/HopsList.do - 1,2,5 (My answer) 1,5,2 (Book answer)
Case 2: /Recipes/Modify/ModRecipes.do - 1,4,5(My answer) 1,5,4 (Book answer)

Its given in the book that "filters with matching url-pattern are placed in the chain in the orderin which they are declared in the DD". So In my case 1,Filter 2 is declared before filter 5 so it should be placed first in the filter chain before filter 5. Correct me if I am wrong.

Thanks
Srividhya
sudhakar karnati
Ranch Hand

Joined: May 03, 2007
Posts: 93
Case 1: /Recipes/HopsList.do - 1,2,5 (My answer) 1,5,2 (Book answer)
Case 2: /Recipes/Modify/ModRecipes.do - 1,4,5(My answer) 1,5,4 (Book answer)


You are considering the order of occurences of mapping elements but it is not the case. First match all the url pattern filters and then servlet mapping elements..As you can see in the book answers servlet mapping filter is the last filter in both cases..

Thanks & Regards,
Sudhakar Karnati
Srividhya Kiran
Ranch Hand

Joined: Feb 17, 2008
Posts: 166
Thanks sudhakar I got it.
Amruth Puppala
Ranch Hand

Joined: Jul 14, 2008
Posts: 295
I didn't get it please can you please with some more clarity please.


SCJP 5 |SCWCD 5| Started thinking about Web Services ?
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Originally posted by Chintu sirivennela:
I didn't get it please can you please with some more clarity please.


There are 2 ways to findout filter for the particular servlet used by the Container

one is by <url-pattern>
2nd is by <servlet-name>


--------------------------------------------------------------------
in the 2 ways container will give 1st periorty to <url-pattern>
--------------------------------------------------------------------

Hope this helps
Amruth Puppala
Ranch Hand

Joined: Jul 14, 2008
Posts: 295
Hi seetharaman ,

Thanks so much . Now I got it.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Filter Mapping
 
Similar Threads
Filter Q in HF Book
Doubt in HFSJ sharpen pencil page 695
[Solved][HFSJ] Filter Preferences
order of filter mapping
unable to understand filter execution sequence