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).]