/** * Sends the buffer data to the client output, checking the state of Response and calling the * right interceptors. * * @param buf Byte buffer to be written to the response * @param off Offset * @param cnt Length * @throws IOException An underlying IOException occurred */ @Override public void realWriteBytes(byte buf[], int off, int cnt) throws IOException { if (closed) return; if (coyoteResponse == null) return; // If we really have something to write if (cnt > 0) { // real write to the adapter outputChunk.setBytes(buf, off, cnt); try { coyoteResponse.doWrite(outputChunk); } 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); } } }