• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Filters chain

 
carina caoor
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<filter-mapping>
<filter-name>Filter1</filter-name>
<servlet-name>ServletToFilter</servlet-name>
</filter-mapping>
<filter-mapping>
<filter-name>Filter2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

On requesting ServletToFilter which filter will b invoked first.
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you tell us first what the rules are, and then which filter will be invoked ? If you understand the rule, you'll be able to figure it out. You'll also understand that we need the servlet mapping for ServletToFilter too.
 
Remko Strating
Ranch Hand
Posts: 893
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Filters which have a matching URL's are first placed in the chain and then filters with a matching servlet name.

HFSJ page 678
 
naresh govindaswmay
Ranch Hand
Posts: 90
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Remko Strating:
Filters which have a matching URL's are first placed in the chain and then filters with a matching servlet name.

HFSJ page 678



hi,
Rules for the matching URL pattern
1.Exact Mapping
2.dirctory Mapping (or extention mapping)
3.wildcard mapping (/*)


Thanks and regards
naresh govindaswamy
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by naresh govindaswmay:

Rules for the matching URL pattern
1.Exact Mapping
2.dirctory Mapping (or extention mapping)
3.wildcard mapping (/*)

This is true for servlets but NOT for filters. Remko is correct. <url-pattern> matches will be added in the order they are declared in the DD. Then the <servlet-name> matches are added to the end of that, also in the order they are declared in the DD.

The 3 ordering rules listed above do not apply to filters.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic