This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Filter Sequence issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Filter Sequence issue" Watch "Filter Sequence issue" New topic
Author

Filter Sequence issue

BO KANG
Greenhorn

Joined: Jun 19, 2008
Posts: 9
Hey ranchers:

One question about Filter mapping sequence :

Given these filter mapping declarations:

<filter-mapping>
<filter-name>FilterOne</filter-name>
<url-pattern>/admin/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>

<filter-mapping>
<filter-name>FilterTwo</filter-name>
<url-pattern>/users/*</url-pattern>
</filter-mapping>

<filter-mapping>
<filter-name>FilterThree</filter-name>
<url-pattern>/admin/*</url-pattern>
</filter-mapping>

<filter-mapping>
<filter-name>FilterTwo</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

in what order are the filters invoked for the following browser request?
/admin/index.jsp

a FilterOne, FilterThree
b FilterOne, FilterTwo, FilterThree
c FilterThree, FilterTwo
d FilterThree, FilterTwo
e FilterThree
f None of these filters are invoked.

The answer is d,but i think it should be FilterOne FilterThree FilterTwo?

Thanks
Amit Prakash Singh
Ranch Hand

Joined: May 11, 2006
Posts: 38
Answer d is correct as the filter one has <dispatcher> element with value forward. Which will act only when the request has been forwarded to this url-pattern.


Amit Prakash Singh<br /> <br />SCJP 1.4 93% <br />SCWCD1.5 85%
BO KANG
Greenhorn

Joined: Jun 19, 2008
Posts: 9
Yes yes ,thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Filter Sequence issue