• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Filtering Responses

 
Johnnie Smith
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
author & internet detective
Marshal
Posts: 34656
365
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic