Ever since version 1.1, BufferedServletOutputStream.flush() checks to see if
if the response is using an PrintWriter and if it is it ignores the flush
request.  The question is why?  My guess is that it had something to do with
the fact that the PrintWriter itself has a buffer because it uses an
OutputStreamWriter internally, but that still doesn't make any sense.

The net result is that if a servlet author calls flush on the PrintWriter
returned from response.getWriter() nothing *appears* to happen.  Internally
what happens is that the bytes from the PrintWriter's OutputStreamWriter are
flushed into the BufferedServletOutputStream's buffer, but they aren't sent
to the client.  This is not the behaviour that most servlet authors would
expect and I don't see any reason in the spec that would mandate it.

Does anyone remember or know why BufferedServletOutputStream.flush() does
nothing when a PrintWriter is in use?  There's bug posted against this
behaviour and I don't see any reason why the buffer shouldn't be sent to the
client when a PrintWriter is in use, but before I make a change to something
that's been around for so long I thought I'd see if anyone remembers why it
was done this way to start with.




Reply via email to