You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mauro Bertapelle <ma...@jmatica.com> on 2000/11/27 17:03:08 UTC

tomcat 3.2b8 and response.flushBuffer()

It seems to me that response.flushBuffer()
doesn't work anymore with beta8.

Can someone confirm this ?

Regards,

Mauro Bertapelle
JMatica Srl
mauro.bertapelle@jmatica.com
--

Re: tomcat 3.2b8 and response.flushBuffer()

Posted by Mauro Bertapelle <ma...@jmatica.com>.
Craig,

I was wrong, it's not a problem with tomcat, it's
a different behavior of the browsers: with navigator
(and opera) flushBuffer works as expected, with ie the first
time the page shows up only when completely loaded, but when
reloading the page shows up before as it should, go guess..
 
This is the code I'm using to do the tests (tomcat standalone,
no proxy):

public void doPost(HttpServletRequest request, HttpServletResponse
response)
      throws ServletException, IOException {

    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("<html>");
    out.println("<head><title>Title</title></head>");
    out.println("<body>");
    out.println("phase 1: ..<br>");
    response.flushBuffer();

    try {
      Thread.sleep(5000);
    } catch (InterruptedException e) {
    }
    out.println("phase 2: ..<br>");
    response.flushBuffer();

    try {
      Thread.sleep(5000);
    } catch (InterruptedException e) {
    }
    out.println("phase 3: ..<br>");
    out.println("</body>");
    out.println("</html>");
    out.close();
}

Regards,

Mauro Bertapelle
JMatica Srl
mauro.bertapelle@jmatica.com
--

Re: tomcat 3.2b8 and response.flushBuffer()

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Mauro Bertapelle wrote:

> It seems to me that response.flushBuffer()
> doesn't work anymore with beta8.
>
> Can someone confirm this ?
>

What symptoms are you seeing that lead to this conclusion?

There are at least the following circumstances under which you won't see any
output at the browser even though you've done a response.flushBuffer() call:

* You are running behind Apache, and Apache is still buffering
  the response.

* There is a proxy server between the client and server that is
  buffering the response

* You are creating an HTML response, but you flush in the middle
  of a paragraph or some other element.  For example:

        <html>
        <head>
        <title>My Title</title>
        </head>
        <body>
        <p>This is a paragraph that should be partially flushed
FLUSH HERE -->
        and then completed later.</p>
        </body>
        </html>

In the latter case, the browser won't display the first line of the paragraph
even if the flush works perfectly, because it does not know what the remaining
text of the paragraph will contain, and therefore cannot format the screen yet.

>
> Regards,
>
> Mauro Bertapelle
> JMatica Srl
> mauro.bertapelle@jmatica.com
> --

Craig McClanahan