tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 侯树成 <chain...@gmail.com>
Subject doe response auto commit when browser abort or close?
Date Tue, 31 Dec 2013 07:53:13 GMT
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.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message