Win a copy of Head First Android this week in the Android forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Q on filters?

 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HFSJ pp678:


The container's rules for ordering filters: when more than one filter is mapped to a given resource:
- 1. ALL filters with matching URL patterns are located first. The order will be the order they are declared in DD.
- 2. Once all filters with matching URLs are placed in the chain, the Container does the same thing with the filters that have a matching <servlt-name> in the DD.



I tried to have 2 filters mapped to one URL like this:


<filter-mapping>
<filter-name>JspFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>

<filter-mapping>
<filter-name>BeerRequest</filter-name>
<servlet-name>*.jsp</servlet-name>
</filter-mapping>



According to HFSJ, both filters will be called, in the order they are defined in DD, right? But how come only one filter is called?

Thanks!
Jenny
 
Jingh Yi
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, guys. My bad on the DD. it should be:


<filter-mapping>
<filter-name>BeerRequest</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>



Now it works as HFSJ says.

Have a nice weekend, guys!
Jenny
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic