Output buffer.
activeFilters
protected OutputFilter[] activeFilters
Active filter (which is actually the top of the pipeline).
buf
protected byte[] buf
Pointer to the current read buffer.
committed
protected boolean committed
Committed flag.
filterLibrary
protected OutputFilter[] filterLibrary
Filter library.
Note: Filter[0] is always the "chunked" filter.
finished
protected boolean finished
Finished flag.
headerBuffer
protected byte[] headerBuffer
HTTP header buffer.
headers
protected MimeHeaders headers
Headers of the associated request.
lastActiveFilter
protected int lastActiveFilter
Index of the last active filter.
outputStream
protected OutputStream outputStream
Underlying output stream.
outputStreamOutputBuffer
protected OutputBuffer outputStreamOutputBuffer
Underlying output buffer.
pos
protected int pos
Position in the buffer.
response
protected Response response
Associated Coyote response.
sm
protected static StringManager sm
The string manager for this package.
socketBuffer
protected ByteChunk socketBuffer
Socket buffer.
useSocketBuffer
protected boolean useSocketBuffer
Socket buffer (extra buffering to reduce number of packets sent).
addActiveFilter
public void addActiveFilter(OutputFilter filter)
Add an output filter to the filter library.
addFilter
public void addFilter(OutputFilter filter)
Add an output filter to the filter library.
clearFilters
public void clearFilters()
Clear filters.
commit
protected void commit()
throws IOException
Commit the response.
doWrite
public int doWrite(ByteChunk chunk,
Response res)
throws IOException
Write the contents of a byte chunk.
- doWrite in interface OutputBuffer
chunk
- byte chunk
- number of bytes written
endHeaders
public void endHeaders()
End the header block.
endRequest
public void endRequest()
throws IOException
End request.
flush
public void flush()
throws IOException
Flush the response.
getOutputStream
public OutputStream getOutputStream()
Get the underlying socket output stream.
nextRequest
public void nextRequest()
End processing of current HTTP request.
Note: All bytes of the current request should have been already
consumed. This method only resets all the pointers so that we are ready
to parse the next HTTP request.
recycle
public void recycle()
Recycle the output buffer. This should be called when closing the
connection.
reset
public void reset()
Reset current response.
sendAck
public void sendAck()
throws IOException
Send an acknoledgement.
sendHeader
public void sendHeader(String name,
String value)
Send a header.
name
- Header namevalue
- Header value
sendHeader
public void sendHeader(ByteChunk name,
ByteChunk value)
Send a header.
name
- Header namevalue
- Header value
sendHeader
public void sendHeader(MessageBytes name,
MessageBytes value)
Send a header.
name
- Header namevalue
- Header value
sendStatus
public void sendStatus()
Send the response status line.
setOutputStream
public void setOutputStream(OutputStream outputStream)
Set the underlying socket output stream.
setSocketBuffer
public void setSocketBuffer(int socketBufferSize)
Set the socket buffer size.
write
protected void write(String s)
This method will write the contents of the specyfied String to the
output stream, without filtering. This method is meant to be used to
write the response header.
s
- data to be written
write
protected void write(byte[] b)
This method will write the contents of the specyfied byte
buffer to the output stream, without filtering. This method is meant to
be used to write the response header.
b
- data to be written
write
protected void write(int i)
This method will print the specified integer to the output stream,
without filtering. This method is meant to be used to write the
response header.
i
- data to be written
write
protected void write(ByteChunk bc)
This method will write the contents of the specyfied message bytes
buffer to the output stream, without filtering. This method is meant to
be used to write the response header.
bc
- data to be written
write
protected void write(MessageBytes mb)
This method will write the contents of the specyfied message bytes
buffer to the output stream, without filtering. This method is meant to
be used to write the response header.
mb
- data to be written