wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Filters chain 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 "Filters chain" Watch "Filters chain" New topic
Author

Filters chain

carina caoor
Ranch Hand

Joined: Jun 23, 2007
Posts: 300

<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

Joined: Nov 24, 2005
Posts: 14688
    
  16

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.


[My Blog]
All roads lead to JavaRanch
Remko Strating
Ranch Hand

Joined: Dec 28, 2006
Posts: 893
Filters which have a matching URL's are first placed in the chain and then filters with a matching servlet name.

HFSJ page 678


Remko (My website)
SCJP 1.5, SCWCD 1.4, SCDJWS 1.4, SCBCD 1.5, ITIL(Manager), Prince2(Practitioner), Reading/ gaining experience for SCEA,
naresh govindaswmay
Ranch Hand

Joined: Aug 15, 2007
Posts: 90
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


Thanks and Regards<br />Naresh govindaswamy
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

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.


A good workman is known by his tools.
 
GeeCON Prague 2014
 
subject: Filters chain