Re: doe response auto commit when browser abort or close?

2013-12-31 Thread Mark Thomas
On 31/12/2013 07:53, 侯树成 wrote:
> Hi, I got an Exception like this:
> 
> java.lang.IllegalStateException: Cannot call sendError() after the response
> has been committed
> 
> 
> I got it in following steps:
> 1. Deploy a web app.
> 2. request the app in browser, refresh the page when it not response
> fully(or close it when the page not response correctly)
> 3. get the exception
> 
> 
> the exception was throw in blow code:
> 
> class OutputBuffer
>  public void realWriteBytes(byte buf[], int off, int cnt) {
>  .
> coyoteResponse.doWrte(outputChunk);   //it will throw
> "java.io.IOException: An established connection was aborted
>   //by the software in your host
> machine"
> } catch (IOException e) {
> // An IOException on a write is almost always due to
> // the remote client aborting the request.  Wrap this
> // so that it can be handled better by the error dispatcher.
> throw new ClientAbortException(e);  // it will handled by
> outter code.But now the commit equals true when sendError method execute,
> so
>//IllegalStateException will throw.
> }
> }
> 
> Does the response will set commit = true when the client close or abort?

No.

Mark

> In source code, I just find the flush method or close method will set
> commit = true, others was correct request/response lifecycle.
> 
> Thanks in advance.
> 


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



doe response auto commit when browser abort or close?

2013-12-30 Thread 侯树成
Hi, I got an Exception like this:

java.lang.IllegalStateException: Cannot call sendError() after the response
has been committed


I got it in following steps:
1. Deploy a web app.
2. request the app in browser, refresh the page when it not response
fully(or close it when the page not response correctly)
3. get the exception


the exception was throw in blow code:

class OutputBuffer
 public void realWriteBytes(byte buf[], int off, int cnt) {
 .
coyoteResponse.doWrte(outputChunk);   //it will throw
"java.io.IOException: An established connection was aborted
  //by the software in your host
machine"
} catch (IOException e) {
// An IOException on a write is almost always due to
// the remote client aborting the request.  Wrap this
// so that it can be handled better by the error dispatcher.
throw new ClientAbortException(e);  // it will handled by
outter code.But now the commit equals true when sendError method execute,
so
   //IllegalStateException will throw.
}
}

Does the response will set commit = true when the client close or abort?
In source code, I just find the flush method or close method will set
commit = true, others was correct request/response lifecycle.

Thanks in advance.