public class Http11OutputBuffer extends Object implements HttpOutputBuffer
Modifier and Type | Class and Description |
---|---|
protected class |
Http11OutputBuffer.SocketOutputBuffer
This class is an output buffer which will write data to a socket.
|
Modifier and Type | Field and Description |
---|---|
protected OutputFilter[] |
activeFilters
Active filters for the current request.
|
protected long |
byteCount
Bytes written to client for the current request
|
protected OutputFilter[] |
filterLibrary
Filter library for processing the response body.
|
protected ByteBuffer |
headerBuffer
The buffer used for header composition.
|
protected int |
lastActiveFilter
Index of the last active filter.
|
protected HttpOutputBuffer |
outputStreamOutputBuffer
Underlying output buffer.
|
protected Response |
response
Associated Coyote response.
|
protected boolean |
responseFinished
Finished flag.
|
protected static StringManager |
sm
The string manager for this package.
|
protected SocketWrapperBase<?> |
socketWrapper
Wrapper for socket where data will be written to.
|
Modifier | Constructor and Description |
---|---|
protected |
Http11OutputBuffer(Response response,
int headerBufferSize,
boolean sendReasonPhrase) |
Modifier and Type | Method and Description |
---|---|
void |
addActiveFilter(OutputFilter filter)
Add an output filter to the active filters for the current response.
|
void |
addFilter(OutputFilter filter)
Add an output filter to the filter library.
|
protected void |
commit()
Commit the response.
|
int |
doWrite(ByteBuffer chunk)
Write the given data to the response.
|
int |
doWrite(ByteChunk chunk)
Deprecated.
Unused. Will be removed in Tomcat 9. Use
doWrite(ByteBuffer) |
void |
end()
Finish writing the current response.
|
void |
endHeaders()
End the header block.
|
void |
flush()
Flush the response.
|
protected boolean |
flushBuffer(boolean block)
Writes any remaining buffered data.
|
long |
getBytesWritten()
Bytes written to the underlying socket.
|
OutputFilter[] |
getFilters()
Get filters.
|
boolean |
hasDataToWrite() |
void |
init(SocketWrapperBase<?> socketWrapper) |
protected boolean |
isBlocking()
Is standard Servlet blocking IO being used for output?
|
protected boolean |
isReady() |
void |
nextRequest()
End processing of current HTTP request.
|
void |
recycle()
Recycle the output buffer.
|
void |
registerWriteInterest() |
void |
sendAck() |
void |
sendHeader(MessageBytes name,
MessageBytes value)
Send a header.
|
void |
sendStatus()
Send the response status line.
|
void |
write(byte[] b)
This method will write the contents of the specified byte
buffer to the output stream, without filtering.
|
protected static final StringManager sm
protected Response response
protected boolean responseFinished
protected final ByteBuffer headerBuffer
protected OutputFilter[] filterLibrary
protected OutputFilter[] activeFilters
protected int lastActiveFilter
protected HttpOutputBuffer outputStreamOutputBuffer
protected SocketWrapperBase<?> socketWrapper
protected long byteCount
protected Http11OutputBuffer(Response response, int headerBufferSize, boolean sendReasonPhrase)
public void addFilter(OutputFilter filter)
filter
- The filter to addpublic OutputFilter[] getFilters()
public void addActiveFilter(OutputFilter filter)
The filter does not have to be present in getFilters()
.
A filter can only be added to a response once. If the filter has already been added to this response then this method will be a NO-OP.
filter
- The filter to add@Deprecated public int doWrite(ByteChunk chunk) throws IOException
doWrite(ByteBuffer)
OutputBuffer
doWrite
in interface OutputBuffer
chunk
- data to writeIOException
- an underlying I/O error occurredpublic int doWrite(ByteBuffer chunk) throws IOException
OutputBuffer
doWrite
in interface OutputBuffer
chunk
- data to writeIOException
- an underlying I/O error occurredpublic long getBytesWritten()
OutputBuffer
getBytesWritten
in interface OutputBuffer
public void flush() throws IOException
flush
in interface HttpOutputBuffer
IOException
- an underlying I/O error occurredpublic void end() throws IOException
HttpOutputBuffer
OutputBuffer.doWrite(java.nio.ByteBuffer)
during the execution of
this method.end
in interface HttpOutputBuffer
IOException
- If an I/O error occurs while writing to the clientpublic void recycle()
public void nextRequest()
public void init(SocketWrapperBase<?> socketWrapper)
public void sendAck() throws IOException
IOException
protected void commit() throws IOException
IOException
- an underlying I/O error occurredpublic void sendStatus()
public void sendHeader(MessageBytes name, MessageBytes value)
name
- Header namevalue
- Header valuepublic void endHeaders()
public void write(byte[] b)
b
- data to be writtenprotected boolean flushBuffer(boolean block) throws IOException
block
- Should this method block until the buffer is emptytrue
if data remains in the buffer (which can only
happen in non-blocking mode) else false
.IOException
- Error writing dataprotected final boolean isBlocking()
true
if this is blocking IOprotected final boolean isReady()
public boolean hasDataToWrite()
public void registerWriteInterest()
Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.