• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Filter Mapping

 
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks sudhakar I got it.
 
Ranch Hand
Posts: 295
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I didn't get it please can you please with some more clarity please.
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 295
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi seetharaman ,

Thanks so much . Now I got it.
 
when your children are suffering from your punishment, tell your them it will help them write good poetry when they are older. Like this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic