File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Questions re: response.getOutputStream()

 
Richard Olson
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Hi,

I'm a newbie try to complete the following goal. We need a utility for capturing or intercepting HTTP responses then writing the output to a file for troubleshooting purposes; something like a sniffer, but without packet info.

I've tried various methods, but so far no success. I�ve tried using ServerOutputStream sOutStr = response.getOutputStream(). How do I write the output to a file? No write methods exist for writing ServerOutputStream to a file. I looked at some of the other streams, but none seem to fit my purposes or I missed the boat.

Any ideas because I�m confused. Hopefully, my description makes sense.

Thanks,
Rich
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The typical approach (which isn't real friendly to newbies) is to wrap the response in an instance of HttpServletResonseWrapper and override the methods needed to alter the response's behaviour.

I have a rough example of this on my site:
http://simple.souther.us/capture.war

In it the response is captured in a filter and written to stdout.
I could be altered very easily to write the output to file.
 
Richard Olson
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Ben, I'll take a look
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic