@Override public void write(int b) throws IOException { // Shouldn't get used for good performance, but is needed for // compatibility with Sun JDK 1.4.0 outputChunk.put(0, (byte) (b & 0xff)); buffer.doWrite(outputChunk); } @Override
@Override public void write(byte[] b, int off, int len) throws IOException { buffer.doWrite(ByteBuffer.wrap(b, off, len)); } @Override
@Override public int doWrite(ByteBuffer chunk) throws IOException { int result = chunk.remaining(); if (result <= 0) { return 0; } int pos = calculateChunkHeader(result); chunkHeader.position(pos + 1).limit(chunkHeader.position() + 9 - pos); buffer.doWrite(chunkHeader); buffer.doWrite(chunk); chunkHeader.position(8).limit(10); buffer.doWrite(chunkHeader); return result; }
@Override public int doWrite(ByteBuffer chunk) throws IOException { if (!coyoteResponse.isCommitted()) { coyoteResponse.sendHeaders(); } return next.doWrite(chunk); }
@Override public int doWrite(ByteBuffer chunk) throws IOException { if (!response.isCommitted()) { // Send the connector a request for commit. The connector should // then validate the headers, send them (using sendHeaders) and // set the filters accordingly. response.action(ActionCode.COMMIT, null); } if (lastActiveFilter == -1) { return outputStreamOutputBuffer.doWrite(chunk); } else { return activeFilters[lastActiveFilter].doWrite(chunk); } }