public class InternalNioOutputBuffer extends Object implements OutputBuffer
InternalNioOutputBuffer
Created on Dec 16, 2011 at 9:15:05 AMModifier and Type | Field and Description |
---|---|
protected OutputFilter[] |
activeFilters
Active filter (which is actually the top of the pipeline).
|
protected ByteBuffer |
bbuf
Direct byte buffer used for writing.
|
protected byte[] |
buf
Pointer to the current write buffer.
|
protected NioChannel |
channel
Underlying channel.
|
protected boolean |
committed
Committed flag.
|
protected NioEndpoint |
endpoint
NIO endpoint.
|
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 ByteChunk |
leftover
Leftover bytes which could not be written during a non blocking write.
|
protected boolean |
nonBlocking
Non blocking mode.
|
protected OutputBuffer |
outputBuffer
Underlying output buffer.
|
protected int |
pos
Position in the buffer.
|
protected Http11NioProcessor |
processor
NIO processor.
|
protected Response |
response
Associated Coyote response.
|
protected int |
writeTimeout
Write timeout
|
Constructor and Description |
---|
InternalNioOutputBuffer(Http11NioProcessor processor,
Response response,
int headerBufferSize,
NioEndpoint endpoint)
Create a new instance of
InternalNioOutputBuffer |
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.
|
protected void |
flushBuffer()
Callback to write data from the buffer.
|
NioChannel |
getChannel()
Get the underlying socket input stream.
|
OutputFilter[] |
getFilters()
Get filters.
|
boolean |
getNonBlocking()
Get the non blocking flag value.
|
protected void |
init() |
void |
nextRequest()
End processing of current HTTP request.
|
void |
recycle()
Recycle this object
|
void |
removeActiveFilters() |
void |
sendAck()
Send an acknowledgment.
|
void |
sendHeader(ByteChunk name,
ByteChunk value)
Send a header.
|
void |
sendHeader(MessageBytes name,
MessageBytes value)
Send a header.
|
void |
sendHeader(String name,
String value)
Send a header.
|
void |
sendStatus()
Send the response status line.
|
void |
setChannel(NioChannel channel)
Set the underlying socket.
|
void |
setNonBlocking(boolean nonBlocking)
Set the non blocking flag.
|
void |
setWriteListener(WriteListener listener)
Set the associated write listener for upgrade mode.
|
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 int |
write(long timeout,
TimeUnit unit)
Perform a write operation.
|
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(String s)
This method will write the contents of the specyfied String to the output
stream, without filtering.
|
protected Response response
protected MimeHeaders headers
protected boolean committed
protected boolean finished
protected byte[] buf
protected int pos
protected OutputBuffer outputBuffer
protected OutputFilter[] filterLibrary
protected OutputFilter[] activeFilters
protected int lastActiveFilter
protected ByteBuffer bbuf
protected ByteChunk leftover
protected boolean nonBlocking
protected int writeTimeout
protected NioChannel channel
protected NioEndpoint endpoint
protected Http11NioProcessor processor
public InternalNioOutputBuffer(Http11NioProcessor processor, Response response, int headerBufferSize, NioEndpoint endpoint)
InternalNioOutputBuffer
response
- headerBufferSize
- endpoint
- protected void init()
public void setChannel(NioChannel channel)
channel
- public NioChannel getChannel()
protected int write(long timeout, TimeUnit unit)
nonBlocking
flag.timeout
- a timeout for the operationunit
- The time unit of the timeoutpublic int doWrite(ByteChunk chunk, Response res) throws IOException
doWrite
in interface OutputBuffer
chunk
- byte chunkres
- used to allow buffers that can be shared by multiple responses.IOException
- an undelying I/O error occuredprotected void flushBuffer() throws IOException
IOException
public void setNonBlocking(boolean nonBlocking)
nonBlocking
- public boolean getNonBlocking()
public void setWriteListener(WriteListener listener)
public void addFilter(OutputFilter filter)
filter
- public OutputFilter[] getFilters()
public void clearFilters()
public void addActiveFilter(OutputFilter filter)
filter
- public void removeActiveFilters()
public void flush() throws IOException
IOException
- an undelying I/O error occuredpublic void recycle()
public void nextRequest()
public void endRequest() throws IOException
IOException
- an undelying I/O error occuredpublic 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(String name, String value)
name
- Header namevalue
- Header valuepublic void endHeaders()
protected void commit() throws IOException
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(String s)
s
- data to be writtenprotected void write(int i)
i
- data to be writtenCopyright © 2015 JBoss by Red Hat. All rights reserved.