actually, you can use filters to capture the response and then use a
filter to dump the whole thing to the outputstream.

What you'll have to do is create your own buffer to hold the content
and not write to either the jspwriter or the printwriter in the
servlet. the tricky part is this. if you have custom error pages,
you'll have to be careful because there may already be "stuff" in the
buffer.

one of these days I'll have to write an example and post a patch for
the tomcat jsp examples.

peter



On Tue, 9 Nov 2004 09:03:10 -0500, Shapira, Yoav <[EMAIL PROTECTED]> wrote:
> 
> Hi,
> I assume that when you say "capture" you mean "handle" ?  Or maybe wrap?
> 
> To only handle outgoing (response) data in a filter, do something like this:
> 
> public void doFilter(ServletRequest request, ServletResponse response, 
> FilterChain chain) throws Blah {
>   chain.doFilter(request, response);
> 
>   // Now do whatever you want with the response
>   // Remember though that the response is likely committed by now
> }
> 
> To only wrap a response is even simpler:
> 
> public void doFilter(ServletRequest request, ServletResponse response, 
> FilterChain chain) throws Blah {
>   // Do whatever
> 
>   chain.doFilter(request, new MyResponseWrapper(response));
> 
>   // Do whatever
> }
> 
> Yoav Shapira http://www.yoavshapira.com
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to