• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HF's Chapter 13 Ques. 5

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
In the HF's chapter - 13 coffee cram exam

Q.no.-5 Which about filter's are true??

in the book option 'E' is given incorrect

"A filter's doFilter() method must call doFilter() on the input FilterChain object in order to ensure that all filters have a chance to execute"

The explanation given in the book is,

"Calling doFilter() is not necessary if a filter wishes to block furthur request processing "

in my openion Both 'E' and the explanation are correct coz....

"It is not necessary to call FilterChain's doFilter(), but to ensure that all filters have a chance to execute it must be called"

and that's what is given in the explanation, explanation is not proving 'E' is incorrect. If 'E' is incorrect then there must be some other way to do the same thing..

tell me if i am wrong

Thanking in advance.....
 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The filter is not required to call the next filter in the chain by invoking doFilter method on the filter chain.

If you don't want to invoke the next filter using chain.doFilter(request, response) you can just send the response back to the client and commit the response. You might want to do this if you are implementing a filter which checks for security, if you find that the request should not be forwarded to the actual target (may be a servlet) then you won't call doFilter and just send an HTTP error code back to the client (HTTP unauthorized error code 403).
reply
    Bookmark Topic Watch Topic
  • New Topic