my dog learned polymorphism
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Question on Filters and RequestDispatcher 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 "Question on Filters and RequestDispatcher" Watch "Question on Filters and RequestDispatcher" New topic

Question on Filters and RequestDispatcher

Radhika Gokhale
Ranch Hand

Joined: Dec 12, 2002
Posts: 40

The Servlet spec on Page 56 explains with examples on the filter patterns and RequestDispatcher behaviour. One of the example is as follows:

<filter-name> Logging Filter </filter-name>
<servlet-name> ProductServlet </servlet-name>
<dispatcher>INCLUDE </dispatcher>

would result in the Logging filter not being invoked by client requests to the ProductServlet, nor underneath a request dispatcher forward() call to the ProductServlet, but would be invoked underneath a request dispatcher include() call where the request dispatcher has a name commencing ProductServlet.

Now my question is why will the Logging Filter not being invoked by client requests to ProductServlet.

Please clarify. Also I have not used Filters in actual programming and want to know how many questions should I expect on it.

Thanks in advance.

georgy jacob
Ranch Hand

Joined: Nov 23, 2005
Posts: 53
As the dispatcher mechanism is mentioned as "include" only include calls will trigger the filter.It will not be invoked for normal client requests.

I agree. Here's the link:
subject: Question on Filters and RequestDispatcher
jQuery in Action, 3rd edition