File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
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://aspose.com/file-tools
 
subject: Filter Mapping