Christopher Schultz schrieb am 12.11.2008 um 14:46:08 (-0500): > Michael Ludwig wrote: > > IllegalStateException: > > > > getOutputStream() has already been called for this response > > > > But I haven't called getOutputStream() - I've called getWriter(). > > Yes, but your included resource probably called getOutputStream.
Yes, this is happening. > You should really override getOutputStream as well as getWriter in > your HttpServletResponseWrapper. That's true. You have to, I think, in order to have your filter work in all situations. > > So how can I implement getOutputStream() to substitute a buffer? > > Does anyone have an implementation? > > How are you doing this with getWriter? With a StringWriter? Maybe you > want to look at java.io.ByteArrayOutputStream. For getWriter(), I was using PrintWriter with CharArrayOutputStream. ByteArrayOutputStream as the most general stream implementation seems to be the right thing to look at. > What you need to do is provide a unified buffer that /both/ calls can > write to. If you use a ByteArrayOutputStream at the lowest level and > then wrap that in an OutputStreamWriter for calls to getWriter(), you > should be able to handle arbitrary use of your wrapper. This sounds very reasonable. I followed this road. Unfortunately, the included resource still is written elsewhere. Or maybe not flushed? > Hope that helps, Yes, this has helped. Thanks! Anyway, what I would like to have is a trace of the method calls that are done by Tomcats's DefaultServlet. Is there a way to get one? Michael Ludwig --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]