org.apache.coyote.http11
public class InternalOutputBuffer extends java.lang.Object implements OutputBuffer, ByteChunk.ByteOutputChannel
Modifier and Type | Class and Description |
---|---|
protected class |
InternalOutputBuffer.OutputStreamOutputBuffer
This class is an output buffer which will write data to an output
stream.
|
Modifier and Type | Field and Description |
---|---|
protected OutputFilter[] |
activeFilters
Active filter (which is actually the top of the pipeline).
|
protected byte[] |
buf
The buffer used for header composition.
|
protected boolean |
committed
Committed flag.
|
protected OutputFilter[] |
filterLibrary
Filter library.
|
protected boolean |
finished
Finished flag.
|
protected MimeHeaders |
headers
Headers of the associated request.
|
protected int |
lastActiveFilter
Index of the last active filter.
|
protected java.io.OutputStream |
outputStream
Underlying output stream.
|
protected OutputBuffer |
outputStreamOutputBuffer
Underlying output buffer.
|
protected int |
pos
Position in the buffer.
|
protected Response |
response
Associated Coyote response.
|
protected static StringManager |
sm
The string manager for this package.
|
protected ByteChunk |
socketBuffer
Socket buffer.
|
protected boolean |
useSocketBuffer
Socket buffer (extra buffering to reduce number of packets sent).
|
Constructor and Description |
---|
InternalOutputBuffer(Response response)
Default constructor.
|
InternalOutputBuffer(Response response,
int headerBufferSize)
Alternate constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addActiveFilter(OutputFilter filter)
Add an output filter to the filter library.
|
void |
addFilter(OutputFilter filter)
Add an output filter to the filter library.
|
void |
clearFilters()
Clear filters.
|
protected void |
commit()
Commit the response.
|
int |
doWrite(ByteChunk chunk,
Response res)
Write the contents of a byte chunk.
|
void |
endHeaders()
End the header block.
|
void |
endRequest()
End request.
|
void |
flush()
Flush the response.
|
OutputFilter[] |
getFilters()
Get filters.
|
java.io.OutputStream |
getOutputStream()
Get the underlying socket output stream.
|
void |
nextRequest()
End processing of current HTTP request.
|
void |
realWriteBytes(byte[] cbuf,
int off,
int len)
Callback to write data from the buffer.
|
void |
recycle()
Recycle the output buffer.
|
void |
reset()
Reset current response.
|
void |
sendAck()
Send an acknoledgement.
|
void |
sendHeader(ByteChunk name,
ByteChunk value)
Send a header.
|
void |
sendHeader(MessageBytes name,
MessageBytes value)
Send a header.
|
void |
sendHeader(java.lang.String name,
java.lang.String value)
Send a header.
|
void |
sendStatus()
Send the response status line.
|
void |
setOutputStream(java.io.OutputStream outputStream)
Set the underlying socket output stream.
|
void |
setSocketBuffer(int socketBufferSize)
Set the socket buffer size.
|
void |
write(byte[] b)
This method will write the contents of the specyfied byte
buffer to the output stream, without filtering.
|
protected void |
write(ByteChunk bc)
This method will write the contents of the specyfied message bytes
buffer to the output stream, without filtering.
|
protected void |
write(CharChunk cc)
This method will write the contents of the specyfied char
buffer to the output stream, without filtering.
|
protected void |
write(int i)
This method will print the specified integer to the output stream,
without filtering.
|
protected void |
write(MessageBytes mb)
This method will write the contents of the specyfied message bytes
buffer to the output stream, without filtering.
|
protected void |
write(java.lang.String s)
This method will write the contents of the specyfied String to the
output stream, without filtering.
|
protected static StringManager sm
protected Response response
protected MimeHeaders headers
protected boolean committed
protected boolean finished
protected byte[] buf
protected int pos
protected java.io.OutputStream outputStream
protected OutputBuffer outputStreamOutputBuffer
protected OutputFilter[] filterLibrary
protected OutputFilter[] activeFilters
protected int lastActiveFilter
protected ByteChunk socketBuffer
protected boolean useSocketBuffer
public InternalOutputBuffer(Response response)
public InternalOutputBuffer(Response response, int headerBufferSize)
public void setOutputStream(java.io.OutputStream outputStream)
public java.io.OutputStream getOutputStream()
public void setSocketBuffer(int socketBufferSize)
public void addFilter(OutputFilter filter)
public OutputFilter[] getFilters()
public void clearFilters()
public void addActiveFilter(OutputFilter filter)
public void flush() throws java.io.IOException
java.io.IOException
- an undelying I/O error occuredpublic void reset()
java.lang.IllegalStateException
- if the response has already been committedpublic void recycle()
public void nextRequest()
public void endRequest() throws java.io.IOException
java.io.IOException
- an undelying I/O error occuredpublic void sendAck() throws java.io.IOException
java.io.IOException
public void sendStatus()
public void sendHeader(MessageBytes name, MessageBytes value)
name
- Header namevalue
- Header valuepublic void sendHeader(ByteChunk name, ByteChunk value)
name
- Header namevalue
- Header valuepublic void sendHeader(java.lang.String name, java.lang.String value)
name
- Header namevalue
- Header valuepublic void endHeaders()
public int doWrite(ByteChunk chunk, Response res) throws java.io.IOException
doWrite
in interface OutputBuffer
chunk
- byte chunkres
- used to allow buffers that can be shared by multiple responses.java.io.IOException
- an undelying I/O error occuredprotected void commit() throws java.io.IOException
java.io.IOException
- an undelying I/O error occuredprotected void write(MessageBytes mb)
mb
- data to be writtenprotected void write(ByteChunk bc)
bc
- data to be writtenprotected void write(CharChunk cc)
cc
- data to be writtenpublic void write(byte[] b)
b
- data to be writtenprotected void write(java.lang.String s)
s
- data to be writtenprotected void write(int i)
i
- data to be writtenpublic void realWriteBytes(byte[] cbuf, int off, int len) throws java.io.IOException
realWriteBytes
in interface ByteChunk.ByteOutputChannel
java.io.IOException
Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.