Re: [Http]ServletResponseWrapper.getOutputStream()

2008-12-27 Thread Michael Ludwig
Christopher Schultz schrieb am 01.12.2008 um 13:15:24 (-0500): > Michael Ludwig wrote: [Better late than never.] > > public HttpResponseCatcher( HttpServletResponse res) { > > super( res); > > this.buffer = new ByteArrayOutputStream(); > > this.stream = new CapturedServletOutputStream( thi

Re: [Http]ServletResponseWrapper.getOutputStream()

2008-12-01 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael, Michael Ludwig wrote: > [Handing out multiple objects] seems to have caused the effect observed, > which was the absence of > the HTML file included via RequestDispatcher.include() in both the > buffer used to capture the response and the ou

Re: [Http]ServletResponseWrapper.getOutputStream()

2008-11-25 Thread Michael Ludwig
I forgot two important lines; explanation in other posts on this thread. Michael Ludwig schrieb am 26.11.2008 um 02:14:58 (+0100): > public ServletOutputStream getOutputStream() throws IOException { getResponse().getOutputStream(); > return stream; > } > > public PrintWriter getWriter()

RE: [Http]ServletResponseWrapper.getOutputStream()

2008-11-25 Thread Caldarale, Charles R
> From: Michael Ludwig [mailto:[EMAIL PROTECTED] > Subject: Re: [Http]ServletResponseWrapper.getOutputStream() > > Why exactly would the output methods have to be synchronized? They don't, unless you've got a weird webapp that itself creates multiple threads that gene

Re: [Http]ServletResponseWrapper.getOutputStream()

2008-11-25 Thread Michael Ludwig
Christopher Schultz schrieb am 25.11.2008 um 09:31:17 (-0500): > Michael Ludwig wrote: > > Your argument in favour of the unified buffer sounds perfectly > > logical to me. In the end, it's all bytes that get written, > > regardless of whether or not I wrap a PrintWriter around the buffer. > > The

Re: [Http]ServletResponseWrapper.getOutputStream()

2008-11-25 Thread Michael Ludwig
Martin Gainty schrieb am 22.11.2008 um 12:02:36 (-0500): > > i agree with the unified buffer but i would also make sure all your > output methods are synchronized Thanks for your feedback, Martin. Why exactly would the output methods have to be synchronized? The request and response objects aren

Re: [Http]ServletResponseWrapper.getOutputStream()

2008-11-25 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Micheal, Michael Ludwig wrote: > Your argument in favour of the unified buffer sounds perfectly logical > to me. In the end, it's all bytes that get written, regardless of > whether or not I wrap a PrintWriter around the buffer. There's always the ca

Re: [Http]ServletResponseWrapper.getOutputStream()

2008-11-25 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Micheal, Michael Ludwig wrote: > Your argument in favour of the unified buffer sounds perfectly logical > to me. In the end, it's all bytes that get written, regardless of > whether or not I wrap a PrintWriter around the buffer. There's always the ca

RE: [Http]ServletResponseWrapper.getOutputStream()

2008-11-22 Thread Martin Gainty
ate: Fri, 21 Nov 2008 22:17:23 +0100 > From: [EMAIL PROTECTED] > To: users@tomcat.apache.org > Subject: Re: [Http]ServletResponseWrapper.getOutputStream() > > Christopher Schultz schrieb am 20.11.2008 um 10:05:48 (-0500): > > Micheal, > > > > Your comment about c

Re: [Http]ServletResponseWrapper.getOutputStream()

2008-11-21 Thread André Warnier
You should post your entire filter next time, if only so André can see it ;) Yes, I'll resubmit it to your scrutiny when it's ready ... I already saw it, copied it, saved it, studied it and sold it to a customer. Now you guys are telling me it's not working ? :-) I did put Michael's name i

Re: [Http]ServletResponseWrapper.getOutputStream()

2008-11-21 Thread Michael Ludwig
Christopher Schultz schrieb am 20.11.2008 um 10:05:48 (-0500): > Keep reading for more. > > Michael Ludwig wrote: > >> So, when this code is called from an "include" call to the request > >> dispatcher, it doesn't appear in your filter's captured output? Or, > >> it doesn't appear in the final re

Re: [Http]ServletResponseWrapper.getOutputStream()

2008-11-21 Thread Michael Ludwig
Christopher Schultz schrieb am 20.11.2008 um 10:05:48 (-0500): > Micheal, > > Your comment about calling getResponse().getOutputStream() and > ignoring the result got me to thinking... Christopher, I may actually have had a point there, although I'm not sure this is the case. I just verified tha

Re: [Http]ServletResponseWrapper.getOutputStream()

2008-11-21 Thread Michael Ludwig
Christopher Schultz schrieb am 18.11.2008 um 16:26:23 (-0500): > > public class HttpResponseCatcher extends HttpServletResponseWrapper { > > > > private ByteArrayOutputStream buffer; > > > > public HttpResponseCatcher( HttpServletResponse res) { > > super( res); > > this.buffer = new ByteA

Re: [Http]ServletResponseWrapper.getOutputStream()

2008-11-20 Thread Michael Ludwig
Michael Ludwig schrieb am 20.11.2008 um 01:58:20 (+0100): > > > >String s = "" + wrapper.toString(); > > >( (HttpServletResponse) res).setHeader( > > > "Zeichen", Integer.toString( s.length())); > > > > Note that this may not be correct: other filters could be adding > > content, and

Re: [Http]ServletResponseWrapper.getOutputStream()

2008-11-20 Thread Michael Ludwig
Caldarale, Charles R schrieb am 19.11.2008 um 19:45:37 (-0600): > > > Try/catch can't be that much of a problem, can it? Isn't it > > just a fancy way of conditional branching with information > > attached? > > Sorry, but no. The throwing of an exception causes the current block > to terminate a

Re: [Http]ServletResponseWrapper.getOutputStream()

2008-11-20 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Micheal, Your comment about calling getResponse().getOutputStream() and ignoring the result got me to thinking... You know what? I just realized that I've been leading you down the wrong path: you must manage the buffers separately because of the "yo

RE: [Http]ServletResponseWrapper.getOutputStream()

2008-11-19 Thread Caldarale, Charles R
> From: Michael Ludwig [mailto:[EMAIL PROTECTED] > Subject: Re: [Http]ServletResponseWrapper.getOutputStream() > Try/catch can't be that much of a problem, can it? Isn't it > just a fancy way of conditional branching with information > attached? Sorry, but no. The

Re: [Http]ServletResponseWrapper.getOutputStream()

2008-11-19 Thread Michael Ludwig
Hi Christopher, thanks for a long and detailed response. Christopher Schultz schrieb am 18.11.2008 um 16:26:23 (-0500): > Michael Ludwig wrote: > > I thought it helpful to have a trace of the methods getting called > One way to do it is to use a "proxy object". If you haven't used proxies > bef

Re: [Http]ServletResponseWrapper.getOutputStream()

2008-11-18 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael, Michael Ludwig wrote: > It's not clear to me which methods I have to implement in order to see > the included static resource processed by Tomcat's DefaultServlet appear > in the output regardless of the output method (PW or SOS) being chosen

Re: [Http]ServletResponseWrapper.getOutputStream()

2008-11-17 Thread Michael Ludwig
Michael Ludwig schrieb am 17.11.2008 um 22:34:16 (+0100): > * ../include.html > * web.xml > * WEB-INF/src/milu/IncludeServlet.java > * WEB-INF/src/milu/GuFilter.java > * WEB-INF/src/milu/HttpResponseCatcher.java > * WEB-INF/src/milu/CapturedServletOutputStream.java Correction: I'm in WEB-INF here,

Re: [Http]ServletResponseWrapper.getOutputStream()

2008-11-17 Thread Michael Ludwig
Christopher Schultz schrieb am 16.11.2008 um 19:43:00 (-0500): > Michael Ludwig wrote: > > Christopher Schultz schrieb am 12.11.2008 um 14:46:08 (-0500): > >> What you need to do is provide a unified buffer that /both/ calls > >> can write to. If you use a ByteArrayOutputStream at the lowest > >> l

Re: [Http]ServletResponseWrapper.getOutputStream()

2008-11-16 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael, Michael Ludwig wrote: > Christopher Schultz schrieb am 12.11.2008 um 14:46:08 (-0500): >> 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 wr

Re: [Http]ServletResponseWrapper.getOutputStream()

2008-11-15 Thread Michael Ludwig
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 pr

Re: [Http]ServletResponseWrapper.getOutputStream()

2008-11-12 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael, Michael Ludwig wrote: > So the output of S gets collected by WR and is now available to F. And F > calls getWriter() on the original response, and this to my surprise > triggers an IllegalStateException: > > getOutputStream() has already b

Re: [Http]ServletResponseWrapper.getOutputStream()

2008-11-11 Thread Michael Ludwig
Michael Ludwig schrieb am 12.11.2008 um 02:37:29 (+0100): > But even with my Filter overriding both getOutputStream() and > getWriter() and substituting buffers that will be written to, there is > a problem. Servlet S will write to one buffer, and the DefaultServlet > will write to another one. The