*
The moose likes Servlets and the fly likes Filters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Filters" Watch "Filters" New topic
Author

Filters

Sondra Colagrossi
Ranch Hand

Joined: Oct 30, 2002
Posts: 68
I been shopping in the pet store and I'm confused about how the FilterChain gets setup.
The following element is from the 2.3 DTD.
<!ELEMENT filter-mapping (filter-name, (url-pattern | servlet-name))>
So if I have the following in my deployment descriptor:
<filter-mapping>
<filter-name> filter_1 </filter-name>
<servlet-name> myServlet </servlet-name>
</filter-mapping>
<filter-mapping>
<filter-name> filter_2 </filter-name>
<servlet-name> myServlet </servlet-name>
</filter-mapping>
<filter-mapping>
<filter-name> filter_3 </filter-name>
<servlet-name> myServlet </servlet-name>
</filter-mapping>
I can expect the container to setup the FilterChain of filter_1, filter_2, filter_3.
The FilterChain.doFilter( req, res ) is a call from filter to filter?
[ December 17, 2002: Message edited by: Bob Fred ]
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi Bob,
Your assumption is correct: the container will setup the filter chaining for you.
However, you will need to indicate (in your filter code) when this chaining occurs. This is where you will have to call the chain.doFilter (request, response) method.
Cheers
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Filters
 
Similar Threads
How to specific numerous url-patterns in web.xml
role-link and role-name elements?
servlet-name
Q: Filter on Page 668 and page 695
role-link and role-name elements?