public class Http11OutputBuffer extends java.lang.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 java.nio.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) |
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(java.nio.ByteBuffer chunk)
Write the given data to the response.
|
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 final Response response
protected boolean responseFinished
protected final java.nio.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)
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 addpublic int doWrite(java.nio.ByteBuffer chunk) throws java.io.IOException
OutputBuffer
doWrite
in interface OutputBuffer
chunk
- data to writejava.io.IOException
- an underlying I/O error occurredpublic long getBytesWritten()
OutputBuffer
getBytesWritten
in interface OutputBuffer
public void flush() throws java.io.IOException
flush
in interface HttpOutputBuffer
java.io.IOException
- an underlying I/O error occurredpublic void end() throws java.io.IOException
HttpOutputBuffer
OutputBuffer.doWrite(java.nio.ByteBuffer)
during the execution of
this method.end
in interface HttpOutputBuffer
java.io.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 java.io.IOException
java.io.IOException
protected void commit() throws java.io.IOException
java.io.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 java.io.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
.java.io.IOException
- Error writing dataprotected final boolean isBlocking()
true
if this is blocking IOprotected final boolean isReady()
public boolean hasDataToWrite()
public void registerWriteInterest()
Copyright © 2000-2022 Apache Software Foundation. All Rights Reserved.