Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mortbay.jetty
Class HttpGenerator

    java.lang.Object
      org.mortbay.jetty.AbstractGenerator
          org.mortbay.jetty.HttpGenerator

All Implemented Interfaces:
  Generator

    public class HttpGenerator

extends AbstractGenerator

HttpGenerator. Builds HTTP Messages.

Author:
  gregw

Nested Class Summary

Nested classes/interfaces inherited from class org.mortbay.jetty.AbstractGenerator
`AbstractGenerator.Output, AbstractGenerator.OutputWriter`

Field Summary

Fields inherited from class org.mortbay.jetty.AbstractGenerator
`_buffer, _buffers, _close, _content, _contentBufferSize, _contentLength, _contentWritten, _endp, _head, _header, _headerBufferSize, _last, _method, _noContent, _reason, _state, _status, _uri, _version, STATE_CONTENT, STATE_END, STATE_FLUSHING, STATE_HEADER`

Fields inherited from interface org.mortbay.jetty.Generator
`LAST, MORE`

Constructor Summary
`HttpGenerator(Buffers buffers, EndPoint io, int headerBufferSize, int contentBufferSize)` Constructor.

Method Summary
`void` | `addContent(Buffer content, boolean last)` Add content.
`boolean` | `addContent(byte b)` Add content.
`void` | `complete()` Complete the message.
`void` | `completeHeader(HttpFields fields, boolean allContentAdded)`
`long` | `flush()`
`int` | `getBytesBuffered()`
`boolean` | `isBufferFull()`
`boolean` | `isEmpty()`
`protected int` | `prepareUncheckedAddContent()` Prepare buffer for unchecked writes.
`void` | `reset(boolean returnBuffers)`
`void` | `sendResponse(Buffer response)` send complete response.
`static void` | `setServerVersion(java.lang.String version)`
`java.lang.String` | `toString()`

Methods inherited from class org.mortbay.jetty.AbstractGenerator
`getContentBufferSize, getContentWritten, getReason, getReasonBuffer, getSendServerVersion, getState, getUncheckedBuffer, getVersion, increaseContentBufferSize, isCommitted, isComplete, isContentWritten, isHead, isIdle, isPersistent, isState, resetBuffer, sendError, setContentLength, setHead, setPersistent, setRequest, setResponse, setSendServerVersion, setVersion`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### HttpGenerator

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

  Constructor.

  Parameters:
    `buffers` - buffer pool
    `headerBufferSize` - Size of the buffer to allocate for HTTP header
    `contentBufferSize` - Size of the buffer to allocate for HTTP content

Method Detail

### setServerVersion

    public static void setServerVersion(java.lang.String version)

### reset

    public void reset(boolean returnBuffers)

  Specified by:
    `reset` in interface `Generator`
  Overrides:
    `reset` in class `AbstractGenerator`

### addContent

    public void addContent(Buffer content,
                           boolean last)
                    throws java.io.IOException

  Add content.

  Parameters:
    `content` -
    `last` -
  Throws:
    `java.lang.IllegalArgumentException` - if `content` is `immutable`.
    `java.lang.IllegalStateException` - If the request is not expecting any more content, or if the buffers are full and cannot be flushed.
    `java.io.IOException` - if there is a problem flushing the buffers.

### sendResponse

    public void sendResponse(Buffer response)
                      throws java.io.IOException

  send complete response.

  Parameters:
    `response` -
  Throws:
    `java.io.IOException`

### addContent

    public boolean addContent(byte b)
                       throws java.io.IOException

  Add content.

  Parameters:
    `b` - byte
  Returns:
    true if the buffers are full
  Throws:
    `java.io.IOException`

### prepareUncheckedAddContent

    protected int prepareUncheckedAddContent()
                                      throws java.io.IOException

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

  Specified by:
    `prepareUncheckedAddContent` in class `AbstractGenerator`
  Returns:
    the available space in the buffer.
  Throws:
    `java.io.IOException`

### isBufferFull

    public boolean isBufferFull()

  Specified by:
    `isBufferFull` in interface `Generator`
  Overrides:
    `isBufferFull` in class `AbstractGenerator`

### completeHeader

    public void completeHeader(HttpFields fields,
                               boolean allContentAdded)
                        throws java.io.IOException

  Specified by:
    `completeHeader` in interface `Generator`
  Specified by:
    `completeHeader` in class `AbstractGenerator`
  Throws:
    `java.io.IOException`

### complete

    public void complete()
                  throws java.io.IOException

  Complete the message.

  Specified by:
    `complete` in interface `Generator`
  Overrides:
    `complete` in class `AbstractGenerator`
  Throws:
    `java.io.IOException`

### flush

    public long flush()
               throws java.io.IOException

  Specified by:
    `flush` in interface `Generator`
  Specified by:
    `flush` in class `AbstractGenerator`
  Throws:
    `java.io.IOException`

### getBytesBuffered

    public int getBytesBuffered()

### isEmpty

    public boolean isEmpty()

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 1995-2010 Mort Bay Consulting. All Rights Reserved.