• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Q on filters?

 
Jingh Yi
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic