Top Description Fields Constructors Methods
org.mortbay.jetty

public Class HttpGenerator

extends AbstractGenerator
Class Inheritance
Imports
java.io.IOException, java.util.Iterator, org.mortbay.io.Buffer, .BufferUtil, .Buffers, .EndPoint, .BufferCache.CachedBuffer, org.mortbay.log.Log, org.mortbay.util.StringUtil

HttpGenerator. Builds HTTP Messages.
Author
gregw

Field Summary

Modifier and TypeField and Description
private boolean
private boolean
private boolean
private boolean
private static int
private static byte[]
private static byte[]
private static byte[]
private static byte[]
private static byte[]
private static byte[]
private static byte[]
private static byte[]
Inherited from org.mortbay.jetty.AbstractGenerator:
_buffer_buffers_close_content_contentBufferSize_contentLength_contentWritten_endp_head_header_headerBufferSize_last_method_noContent_reason_state_status_uri_versionSTATE_CONTENTSTATE_ENDSTATE_FLUSHINGSTATE_HEADER

Constructor Summary

AccessConstructor and Description
public
HttpGenerator(Buffers
buffer pool
buffers
,
EndPoint io, int
Size of the buffer to allocate for HTTP header
headerBufferSize
,
int
Size of the buffer to allocate for HTTP content
contentBufferSize
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
public void
addContent(Buffer content, boolean last)

Implements org.mortbay.jetty.Generator.addContent.

Add content.
public boolean

Returns:

true if the buffers are full
addContent
(byte
byte
b
)

Implements org.mortbay.jetty.Generator.addContent.

Add content.
public void
public void
public long
public int
public boolean
public boolean
private void
protected int

Returns:

the available space in the buffer.
prepareUncheckedAddContent
()

Implements abstract org.mortbay.jetty.AbstractGenerator.prepareUncheckedAddContent.

Prepare buffer for unchecked writes.
public void
public void
sendResponse(Buffer response)

send complete response.

public static void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from org.mortbay.jetty.AbstractGenerator:
completeUncheckedAddContentgetContentBufferSizegetContentWrittengetReasongetReasonBuffergetSendServerVersiongetStategetUncheckedBuffergetVersionincreaseContentBufferSizeisCommittedisCompleteisContentWrittenisHeadisIdleisPersistentisStateresetBuffersendErrorsetContentLengthsetHeadsetPersistentsetRequestsetResponsesetSendServerVersionsetVersionuncheckedAddContent

Field Detail

_bufferChunkedback to summary
private boolean _bufferChunked
_bypassback to summary
private boolean _bypass
_needCRLFback to summary
private boolean _needCRLF
_needEOCback to summary
private boolean _needEOC
CHUNK_SPACEback to summary
private static int CHUNK_SPACE
CONNECTION_back to summary
private static byte[] CONNECTION_
CONNECTION_CLOSEback to summary
private static byte[] CONNECTION_CLOSE
CONNECTION_KEEP_ALIVEback to summary
private static byte[] CONNECTION_KEEP_ALIVE
CONTENT_LENGTH_0back to summary
private static byte[] CONTENT_LENGTH_0
CRLFback to summary
private static byte[] CRLF
LAST_CHUNKback to summary
private static byte[] LAST_CHUNK
SERVERback to summary
private static byte[] SERVER
TRANSFER_ENCODING_CHUNKEDback to summary
private static byte[] TRANSFER_ENCODING_CHUNKED

Constructor Detail

HttpGeneratorback to summary
public HttpGenerator(Buffers buffers, EndPoint io, int headerBufferSize, int contentBufferSize)

Constructor.

Parameters
buffers:Buffers

buffer pool

headerBufferSize:int

Size of the buffer to allocate for HTTP header

contentBufferSize:int

Size of the buffer to allocate for HTTP content

Method Detail

addContentback to summary
public void addContent(Buffer content, boolean last) throws IOException

Implements org.mortbay.jetty.Generator.addContent.

Add content.

Exceptions
IOException:
if there is a problem flushing the buffers.
IllegalArgumentException:
if content is immutable.
IllegalStateException:
If the request is not expecting any more content, or if the buffers are full and cannot be flushed.
addContentback to summary
public boolean addContent(byte b) throws IOException

Implements org.mortbay.jetty.Generator.addContent.

Add content.

Parameters
b:byte

byte

Returns:boolean

true if the buffers are full

completeback to summary
public void complete() throws IOException

Overrides org.mortbay.jetty.AbstractGenerator.complete.

Implements org.mortbay.jetty.Generator.complete.

Complete the message.

completeHeaderback to summary
public void completeHeader(HttpFields fields, boolean allContentAdded) throws IOException

Implements abstract org.mortbay.jetty.AbstractGenerator.completeHeader.

Implements org.mortbay.jetty.Generator.completeHeader.

flushback to summary
public long flush() throws IOException

Implements abstract org.mortbay.jetty.AbstractGenerator.flush.

Implements org.mortbay.jetty.Generator.flush.

getBytesBufferedback to summary
public int getBytesBuffered()
isBufferFullback to summary
public boolean isBufferFull()

Overrides org.mortbay.jetty.AbstractGenerator.isBufferFull.

Implements org.mortbay.jetty.Generator.isBufferFull.

isEmptyback to summary
public boolean isEmpty()
prepareBuffersback to summary
private void prepareBuffers()
prepareUncheckedAddContentback to summary
protected int prepareUncheckedAddContent() throws IOException

Implements abstract org.mortbay.jetty.AbstractGenerator.prepareUncheckedAddContent.

Prepare buffer for unchecked writes. Prepare the generator buffer to receive unchecked writes

Returns:int

the available space in the buffer.

resetback to summary
public void reset(boolean returnBuffers)

Overrides org.mortbay.jetty.AbstractGenerator.reset.

Implements org.mortbay.jetty.Generator.reset.

sendResponseback to summary
public void sendResponse(Buffer response) throws IOException

send complete response.

setServerVersionback to summary
public static void setServerVersion(String version)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.