tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Farquhar <>
Subject OutputStreams, Writers and Sitemesh
Date Mon, 02 Feb 2004 04:26:43 GMT

I've searched the mail archive, but couldn't find anything there - so
please feel freee to point me there if this has already been answered.

Sitemesh is a page decoration framework that works on all application
servers, and allows you to decorate your HTML pages.

The way that it works is that the page is captured in a buffer, then
passed to a 'decorator', which does the decoration (using the original
content as input).

More information can be found here:

The problem comes when choosing to use getOutputStream() or getWriter()
to write out the content.  This is because you cannot call both in one

My current method of doing this involves logging which of these is used
by the server, and then using that to print out using either streams or

However, in Tomcat 4.x and later, it seems that getOutputStream() is used
for serving static resources, and getWriter() is used to serve JSPs.

This means that if I buffer up static content (using a
PageResponseWrapper), then I can't then access a JSP using the same
request.  I guess that this will also affect anyone redispatching to a
JSP after accessing a static resource.

So - can anyone point me to a config somewhere that I can tell Tomcat to
use Writers for everything?  Or some other workaround?

If I haven't been clear above - please let me know.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message