wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes HF's Chapter 13 Ques. 5 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 "HF Watch "HF New topic
Author

HF's Chapter 13 Ques. 5

Amitkumar Dhama
Ranch Hand

Joined: Feb 14, 2005
Posts: 56
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.....


SCJP 1.4, SCWCD 1.4, M.Tech(CSE)
Pranav Shukla
Ranch Hand

Joined: Oct 05, 2005
Posts: 64
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).


Pranav Shukla
SCJP, SCWCD, SCBCD
 
Consider Paul's rocket mass heater.
 
subject: HF's Chapter 13 Ques. 5