tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geoff Soutter" <ge...@whitewolf.com.au>
Subject [T4] servlet including jsp causes jsp to flush buffer?
Date Wed, 13 Jun 2001 06:14:39 GMT
Hi,

I've got a servlet which includes a JSP page, and it appears that the JSP
engine in Tomcat 4.0 calls response.flushBuffer() when the include finishes.

IMHO this behaviour is incorrect, as it should be up to the "topmost"
servlet to control what is happening with the buffering as much as possible.
Currently this behaviour is preventing my servlet from controlling the
buffering as it would like to.

I looked though the list and noticed that v3.x has many flushing problems
but I was kinda hoping they'd be fixed in Tomcat 4.x ;-).

Anyway, here's the offending code (I think).

In PageContextImpl.java

public void release() {
  try {
    if (isIncluded) {
      ((JspWriterImpl)out).flushBuffer(); // push it into the including
jspWriter
    } else {
      out.flush();
    }
  } catch (IOException ex) {
    loghelper.log("Internal error flushing the buffer in release()");
  }

and in JspWriterImpl.java

public void flush()  throws IOException {
  synchronized (lock) {
    flushBuffer();
    if (out != null) {
      out.flush();
      // Also flush the response buffer.
      response.flushBuffer();
    }
  }
}

Geoff

--
Keep cool till after school!


Mime
View raw message