0 Replies Latest reply on May 1, 2003 5:55 PM by sstair

    Response buffering bug?

    sstair

      I'm seeing some unexpected behaviour using Jboss 3.2.0 both with tomcat and with jetty.

      I've created a servlet that

      1) writes some text to the ServletOutputStream,
      2) flushes
      3) sleeps a bit
      4) does steps 1-3 a few more times

      All of the output is coming to the browser at once, after the total time from all of the sleep() calls has elapsed.

      I tried using response.flushBuffer(), same result.
      I then tried writing 1000 characters to the output stream, to cause the buffer to overflow, and now it works.

      But here is the wierd part: All of the print/flush/sleep steps that come BEFORE writing the 1000 chars all get sent to the browser at the same time, but AFTER the 1000 chars get sent, every subsequent flush works like it is supposed to.

      It is as if flush() doesn't work until after some initialization which is performed in the code that gets run when the buffer overflows.

      Attached is the test servlet I created to demonstrate.