aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) 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 Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Filters" Watch "Filters" New topic
Author

Filters

sangeeta kapoor
Ranch Hand

Joined: Jun 15, 2004
Posts: 70
Page 699 HF Servlets and JSP
Ques 5

Which about Filters is true


A. Filters may be used to create request and response wrappers.
B. Wrappers may be used to create request or reponse filters

Shouldn't B be correct instead of A
Correct Ans given in book is A
alzamabar
Ranch Hand

Joined: Jul 24, 2002
Posts: 379
I also had the same problem the first time, then I understood. Thanks to filter, it's possible to create a 'wrapper' around a request/response objects. Filters use wrappers but it's not the other way round. Think of a filter to compress the response. The filter uses the HttpServletResponseWrapper class to actually pass behind the scenes a custom response object whose getOutputStream() method returns a custom output stream in gzip format. It's the filter which knows about the wrapper and not the other way round.

Hope this helps


Marco Tedone<br />SCJP1.4,SCJP5,SCBCD,SCWCD
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Filters