aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes filter-mapping order 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 "filter-mapping order" Watch "filter-mapping order" New topic
Author

filter-mapping order

Kram Nart
Ranch Hand

Joined: Jun 05, 2006
Posts: 32
Can someone explain (in detail if you can) the answer of this mock exam question on http://j2eeworld.weebly.com? Thanks.


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.

Answer: d


SCJP 5 <br /> SCWCD 5 <br /> SCBCD <br />
Figuring out what's next...
Dee Brown
Ranch Hand

Joined: Jun 14, 2008
Posts: 94
The url patterns for filter1, filter3, and the second filter2 filter mapping match the request.

However, filter1 uses the "<dispatcher>FORWARD</dispatcher>" element, and will only be invoked on a RequestDispatcher.forward().

So the answer is filter3 and the second filter 2 (i.e. D).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: filter-mapping order