tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: How to do with response.sendError() after the ServletOutputStream is established?
Date Tue, 02 Jun 2009 15:01:29 GMT
Hash: SHA1


On 6/1/2009 1:55 AM, 流水音 wrote:
> when the maxcount() returns 15, the exception is thrown out before the
> first buffer is flushed, then client can get the response code of: 605
> but when the maxcount() returns 99999, the exception is thrown out
> after some buffers flushes, so the client can not get the exception
> anymore, the response code is 200.

Right. After a certain number of characters have been sent to the output
stream (8192 by default, I think), the buffer is flushed and the first
byte (along with others) is sent to the client. This usually includes
all the HTTP response headers, and certainly will include the response
header (the first header sent back to the client).

After the response header has been sent, you cannot change it.

> so, if I want to get the exception during the data transferring in the
> client, do you guys have any idea hot to do that?

Once you've sent a certain amount of data, you will not be able to
change the response code. That's why it's a good idea to do all the work
that could fail /before/ you start sending data back to the client. Of
course, this is not always practical, but a reasonable goal.

Good luck,
- -chris
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message