aspose file tools*
The moose likes JSP and the fly likes Filtering Responses Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Filtering Responses" Watch "Filtering Responses" New topic
Author

Filtering Responses

Johnnie Smith
Greenhorn

Joined: May 02, 2012
Posts: 22
I have a question regarding filtering of responses using wrappers.

I have noted in JSP books that whenever the class HttpServletResponseWrapper is extended by a programmer's own wrapper class, the programmer has to provide definition for both the getWriter() method as well as getOutputStream() method.

Is it required to provide definition for both methods? If so, can somebody tell met the reason as in my case I have provided definition for only the getWriter() method and my filter works fine.

Regards,
John.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30537
    
150

That's interesting. Because Oracle's example also only overrides getWriter().

I've only needed to do this a few times and I didn't override both either. I'm guessing the reason is that a servlet could call getOutputStream() and would miss the new logic. Which does imply it is a good idea. But I haven't been burned not doing it either.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Filtering Responses