Apache Tomcat 7.0.4

org.apache.coyote.http11
Class InternalOutputBuffer

java.lang.Object
  extended by org.apache.coyote.http11.AbstractOutputBuffer
      extended by org.apache.coyote.http11.InternalOutputBuffer
All Implemented Interfaces:
OutputBuffer, ByteChunk.ByteOutputChannel

public class InternalOutputBuffer
extends AbstractOutputBuffer
implements ByteChunk.ByteOutputChannel

Output buffer.

Author:
Remy Maucherat

Nested Class Summary
protected  class InternalOutputBuffer.OutputStreamOutputBuffer
          This class is an output buffer which will write data to an output stream.
 
Field Summary
protected  OutputStream outputStream
          Underlying output stream.
protected  ByteChunk socketBuffer
          Socket buffer.
protected  boolean useSocketBuffer
          Socket buffer (extra buffering to reduce number of packets sent).
 
Fields inherited from class org.apache.coyote.http11.AbstractOutputBuffer
activeFilters, buf, committed, filterLibrary, finished, headers, lastActiveFilter, outputStreamOutputBuffer, pos, response, sm
 
Constructor Summary
InternalOutputBuffer(Response response)
          Default constructor.
InternalOutputBuffer(Response response, int headerBufferSize)
          Alternate constructor.
 
Method Summary
protected  void commit()
          Commit the response.
 void endRequest()
          End request.
 void flush()
          Flush the response.
 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 sendAck()
          Send an acknowledgment.
 void setOutputStream(OutputStream outputStream)
          Set the underlying socket output stream.
 void setSocketBuffer(int socketBufferSize)
          Set the socket buffer size.
 
Methods inherited from class org.apache.coyote.http11.AbstractOutputBuffer
addActiveFilter, addFilter, clearFilters, doWrite, endHeaders, getFilters, reset, sendHeader, sendHeader, sendHeader, sendStatus, write, write, write, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

outputStream

protected OutputStream outputStream
Underlying output stream.


socketBuffer

protected ByteChunk socketBuffer
Socket buffer.


useSocketBuffer

protected boolean useSocketBuffer
Socket buffer (extra buffering to reduce number of packets sent).

Constructor Detail

InternalOutputBuffer

public InternalOutputBuffer(Response response)
Default constructor.


InternalOutputBuffer

public InternalOutputBuffer(Response response,
                            int headerBufferSize)
Alternate constructor.

Method Detail

setOutputStream

public void setOutputStream(OutputStream outputStream)
Set the underlying socket output stream.


getOutputStream

public OutputStream getOutputStream()
Get the underlying socket output stream.


setSocketBuffer

public void setSocketBuffer(int socketBufferSize)
Set the socket buffer size.


flush

public void flush()
           throws IOException
Flush the response.

Overrides:
flush in class AbstractOutputBuffer
Throws:
IOException - an underlying I/O error occurred

recycle

public void recycle()
Recycle the output buffer. This should be called when closing the connection.

Overrides:
recycle in class AbstractOutputBuffer

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.

Overrides:
nextRequest in class AbstractOutputBuffer

endRequest

public void endRequest()
                throws IOException
End request.

Overrides:
endRequest in class AbstractOutputBuffer
Throws:
IOException - an underlying I/O error occurred

sendAck

public void sendAck()
             throws IOException
Send an acknowledgment.

Specified by:
sendAck in class AbstractOutputBuffer
Throws:
IOException

commit

protected void commit()
               throws IOException
Commit the response.

Specified by:
commit in class AbstractOutputBuffer
Throws:
IOException - an underlying I/O error occurred

realWriteBytes

public void realWriteBytes(byte[] cbuf,
                           int off,
                           int len)
                    throws IOException
Callback to write data from the buffer.

Specified by:
realWriteBytes in interface ByteChunk.ByteOutputChannel
Throws:
IOException

Apache Tomcat 7.0.4

Copyright © 2000-2010 Apache Software Foundation. All Rights Reserved.