I think you can save the output in a outputstream, and then write the content of outputstream through both the responses' outputstream and a FileOutputStream to write to server's local disk.
Author and all-around good cowpoke
Joined: Mar 22, 2000
The environment a JSP runs in is rather complex, so I don't think there is anything you can do to the JSP that could divert the output to another stream. (Unless you want to hack the server code - Tomcat comes with complete code) You could have a servlet create a URLconnection to the server (maybe as localhost?) and grab the output that way. Bill ------------------ author of:
Originally posted by Josh Hudgins: I need it to be entirely server side. Preferably something in JSP itself or its Servlet controller.
Do you want to redirect the output to a file, or do you want to log the output in addition to sending it as a normal response to the client? If the former, then URL.getContent()/URLConnection is your friend. If the latter... A very simple way would be to create your own JspWriter subclass which acts as a wrapper class around the "real" JspWriter. At the top of your JSP you would say something like <% out = new MyLoggingWriter(out); %> Not sure if this will still work with complex pages which use dynamic includes or custom tags, but in simple pages it probably does. Along the same lines but slightly more sophisticated would be a custom tag (using the BodyContent class) which would log everything produced between the start and end tags. Finally, a servlet 2.3 filter could probably do it. - Peter
[This message has been edited by Peter den Haan (edited April 29, 2001).]
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com