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.

Reply via email to