• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Question on Filters and RequestDispatcher

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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

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

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.

Radhika
 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As the dispatcher mechanism is mentioned as "include" only include calls will trigger the filter.It will not be invoked for normal client requests.


Thanks,
georgy
 
Here. Have a potato. I grew it in my armpit. And from my other armpit, this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic