This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Filter Sequence issue

 
BO KANG
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
BO KANG
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes yes ,thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic