You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by sl...@jpmorgan.com on 2003/04/10 15:03:32 UTC

flushBuffer does not slush

I need to perform long operation in the servlet and to keep the browser
from timing out I want to send 'progress report' every few seconds. I
understand that writing to the out stream and flushing it should trigger a
send. What I see however is the bufering by the tomcat - the whole content
is sent only when the execution of the request ends. Here is the simple JSP
that shows the problem:



<%@ page language="java" import="java.io.*,java.util.*,java.text.*"
isErrorPage="false"%>
<html>
<body>

<%
    for( int i = 0 ; i < 10 ; ++i ) {
%>
    this is a test of the stuff<br>
<%
response.flushBuffer();
        Thread.sleep(1000);
    }
%>
</body>
</html>



I am using Tomcat 4.0.3 with Apache on Solaris 5.8. I suspected that it may
be the Apache server buffering the output but tracing Tomcat JVM using
'truss' shows no send calls for 10 seconds.
Is there something in the configuration I forgot to set ?

sk





This communication is for informational purposes only.  It is not intended as
an offer or solicitation for the purchase or sale of any financial instrument
or as an official confirmation of any transaction. All market prices, data
and other information are not warranted as to completeness or accuracy and
are subject to change without notice. Any comments or statements made herein
do not necessarily reflect those of J.P. Morgan Chase & Co., its
subsidiaries and affiliates.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: flushBuffer does not slush

Posted by "Mr. Cristian Romanescu" <c....@bucarest.finsiel.ro>.
I think correct is 
        out.flush().


On Thu, 2003-04-10 at 16:03, slavek.f.kuzniar@jpmorgan.com wrote:
> I need to perform long operation in the servlet and to keep the browser
> from timing out I want to send 'progress report' every few seconds. I
> understand that writing to the out stream and flushing it should trigger a
> send. What I see however is the bufering by the tomcat - the whole content
> is sent only when the execution of the request ends. Here is the simple JSP
> that shows the problem:
> 
> 
> 
> <%@ page language="java" import="java.io.*,java.util.*,java.text.*"
> isErrorPage="false"%>
> <html>
> <body>
> 
> <%
>     for( int i = 0 ; i < 10 ; ++i ) {
> %>
>     this is a test of the stuff<br>
> <%
> response.flushBuffer();
>         Thread.sleep(1000);
>     }
> %>
> </body>
> </html>
> 
> 
> 
> I am using Tomcat 4.0.3 with Apache on Solaris 5.8. I suspected that it may
> be the Apache server buffering the output but tracing Tomcat JVM using
> 'truss' shows no send calls for 10 seconds.
> Is there something in the configuration I forgot to set ?
> 
> sk
> 
> 
> 
> 
> 
> This communication is for informational purposes only.  It is not intended as
> an offer or solicitation for the purchase or sale of any financial instrument
> or as an official confirmation of any transaction. All market prices, data
> and other information are not warranted as to completeness or accuracy and
> are subject to change without notice. Any comments or statements made herein
> do not necessarily reflect those of J.P. Morgan Chase & Co., its
> subsidiaries and affiliates.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
-- 
Best regards,

Cristian Romanescu.
Tecnico Junior - Finsiel Romania
Mobile	: +40745133096
Alt	: ext@k.ro

Whoa...I did a "cat /vmlinuz > /dev/audio" and I think I heard God...
        -- mikecd on #Linux



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: flushBuffer does not slush

Posted by Jon Wingfield <jo...@mkodo.com>.
What's the client browser? Does it support incremental rendering? Most 
(if not all) versions of IE only begin to render when the response is 
closed. What happens if you view the page in Mozilla?

Mr. Cristian Romanescu wrote:
> I think correct is 
> 	out.flush().
> 
> regards.
> 
> On Thu, 2003-04-10 at 16:03, slavek.f.kuzniar@jpmorgan.com wrote:
> 
>>I need to perform long operation in the servlet and to keep the browser
>>from timing out I want to send 'progress report' every few seconds. I
>>understand that writing to the out stream and flushing it should trigger a
>>send. What I see however is the bufering by the tomcat - the whole content
>>is sent only when the execution of the request ends. Here is the simple JSP
>>that shows the problem:
>>
>>
>>
>><%@ page language="java" import="java.io.*,java.util.*,java.text.*"
>>isErrorPage="false"%>
>><html>
>><body>
>>
>><%
>>    for( int i = 0 ; i < 10 ; ++i ) {
>>%>
>>    this is a test of the stuff<br>
>><%
>>response.flushBuffer();
>>        Thread.sleep(1000);
>>    }
>>%>
>></body>
>></html>
>>
>>
>>
>>I am using Tomcat 4.0.3 with Apache on Solaris 5.8. I suspected that it may
>>be the Apache server buffering the output but tracing Tomcat JVM using
>>'truss' shows no send calls for 10 seconds.
>>Is there something in the configuration I forgot to set ?
>>
>>sk



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: flushBuffer does not slush

Posted by "Mr. Cristian Romanescu" <c....@bucarest.finsiel.ro>.
I think correct is 
	out.flush().

regards.

On Thu, 2003-04-10 at 16:03, slavek.f.kuzniar@jpmorgan.com wrote:
> I need to perform long operation in the servlet and to keep the browser
> from timing out I want to send 'progress report' every few seconds. I
> understand that writing to the out stream and flushing it should trigger a
> send. What I see however is the bufering by the tomcat - the whole content
> is sent only when the execution of the request ends. Here is the simple JSP
> that shows the problem:
> 
> 
> 
> <%@ page language="java" import="java.io.*,java.util.*,java.text.*"
> isErrorPage="false"%>
> <html>
> <body>
> 
> <%
>     for( int i = 0 ; i < 10 ; ++i ) {
> %>
>     this is a test of the stuff<br>
> <%
> response.flushBuffer();
>         Thread.sleep(1000);
>     }
> %>
> </body>
> </html>
> 
> 
> 
> I am using Tomcat 4.0.3 with Apache on Solaris 5.8. I suspected that it may
> be the Apache server buffering the output but tracing Tomcat JVM using
> 'truss' shows no send calls for 10 seconds.
> Is there something in the configuration I forgot to set ?
> 
> sk
> 
> 
> 
> 
> 
> This communication is for informational purposes only.  It is not intended as
> an offer or solicitation for the purchase or sale of any financial instrument
> or as an official confirmation of any transaction. All market prices, data
> and other information are not warranted as to completeness or accuracy and
> are subject to change without notice. Any comments or statements made herein
> do not necessarily reflect those of J.P. Morgan Chase & Co., its
> subsidiaries and affiliates.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
-- 
Best regards,

Cristian Romanescu.
Tecnico Junior - Finsiel Romania
Mobile	: +40745133096
Alt	: ext@k.ro

Whoa...I did a "cat /vmlinuz > /dev/audio" and I think I heard God...
        -- mikecd on #Linux



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org