JSP's also have a buffer too. To make it smaller or eliminate it:
<%@(protected)'%>
or use out.flush() instead or response.flushBuffer()
-Tim
Richard Mundell wrote:
> No one replied, so in the hope someone might have the answer to this, here's
> a repost... :-)
>
>
> -----Original Message-----
> From: Richard Mundell [mailto:richard.mundell@(protected)]
> Sent: Friday, December 15, 2006 3:37 PM
> To: users@(protected)
> Subject: On Tomcat 5.5.9, can't flush the buffer or reduce buffer size <
> 8192
>
> I'm trying to work around a timeout problem which one of my user's proxy
> server has. The proxy's timeout is set to 1 minute. Should it not receive
> any HTTP traffic for 1 minute it disconnects.
>
> One of my JSPs takes >1 minute to perform processing and return results.
>
> What I'm trying to do is...
>
> 1) Flush out HTTP headers immediately
> 2) (Start my database operation which takes >1 minute)
> 3) Write out and flush to the client a HTML comment (<!--hello-->) every 10
> seconds while the database operation completes to stop the proxy timing out
> 4) (Database operation completes)
> 5) Write out results
>
> By calling response.flushBuffer() immediately at the top of my JSP, the HTTP
> headers are being written out to the TCP stream. So far, so good.
>
> My code then, every 10 seconds, does an out.print("<!-- hello -->") and a
> response.flushBuffer().
>
> By using a packet sniffer I can see that although the headers get output to
> the TCP stream, the "body" of the HTTP response does not get written out
> until the very end of the execution of the JSP. The only way I can get the
> buffer to flush is if I do an out.print with a string greater than 8192
> characters (the default size of the buffer).
>
> Note that I also tried out.flush() and that doesn't work either.
>
> As a workaround I tried to set the buffer size artificially low, but this
> call is being ignored:
>
> System.out.println(response.getBufferSize());
> // buffer size of 8192 printed to stdout
>
> response.setBufferSize(100);
> // buffer size should now be 100, right?
>
> System.out.println(response.getBufferSize());
> // buffer size of 8192 still printed to stdout
>
> setBufferSize only works if I set the buffer > 8192.
>
> I can't find any reference in the Tomcat spec to this being a deliberate
> behavior, or a hard-coded minimum?
>
> Anyone got any ideas of where I'm going wrong, or how I might get this to
> work in Tomcat 5.5.9? (Note that I'm stuck at Tomcat 5.5.9 because the later
> (Apache) HTTPS implementations don't work reliably in our environment).
---------------------------------------------------------------------
To start a new topic, e-mail: users@(protected)
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)