Methods Summary |
---|
public int | doWrite(org.apache.tomcat.util.buf.ByteChunk chunk, org.apache.coyote.Response res)Write some bytes.
int result = -1;
if (contentLength >= 0) {
if (remaining > 0) {
result = chunk.getLength();
if (result > remaining) {
// The chunk is longer than the number of bytes remaining
// in the body; changing the chunk length to the number
// of bytes remaining
chunk.setBytes(chunk.getBytes(), chunk.getStart(),
(int) remaining);
result = (int) remaining;
remaining = 0;
} else {
remaining = remaining - result;
}
buffer.doWrite(chunk, res);
} else {
// No more bytes left to be written : return -1 and clear the
// buffer
chunk.recycle();
result = -1;
}
} else {
// If no content length was set, just write the bytes
buffer.doWrite(chunk, res);
result = chunk.getLength();
}
return result;
|
public long | end()End the current request. It is acceptable to write extra bytes using
buffer.doWrite during the execution of this method.
if (remaining > 0)
return remaining;
return 0;
|
public long | getContentLength()Get content length.
// ------------------------------------------------------------- Properties
return contentLength;
|
public org.apache.tomcat.util.buf.ByteChunk | getEncodingName()Return the name of the associated encoding; Here, the value is
"identity".
return ENCODING;
|
public long | getRemaining()Get remaining bytes.
return remaining;
|
public void | recycle()Make the filter ready to process the next request.
contentLength = -1;
remaining = 0;
|
public void | setBuffer(org.apache.coyote.OutputBuffer buffer)Set the next buffer in the filter pipeline.
this.buffer = buffer;
|
public void | setResponse(org.apache.coyote.Response response)Some filters need additional parameters from the response. All the
necessary reading can occur in that method, as this method is called
after the response header processing is complete.
contentLength = response.getContentLength();
remaining = contentLength;
|