org.eclipse.jetty.http

## Class HttpGenerator

- java.lang.Object
- - org.eclipse.jetty.http.AbstractGenerator
  - - org.eclipse.jetty.http.HttpGenerator

- All Implemented Interfaces:
    Generator

      public class HttpGenerator
      extends AbstractGenerator

  HttpGenerator. Builds HTTP Messages.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `_bypass`

    - ### Fields inherited from class org.eclipse.jetty.http.AbstractGenerator

      `_buffer, _buffers, _content, _contentLength, _contentWritten, _date, _endp, _head, _header, _last, _method, _noContent, _persistent, _reason, _state, _status, _uri, _version, NO_BYTES, STATE_CONTENT, STATE_END, STATE_FLUSHING, STATE_HEADER`

    - ### Fields inherited from interface org.eclipse.jetty.http.Generator

      `LAST, MORE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HttpGenerator(Buffers buffers, EndPoint io)` Constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addContent(Buffer content, boolean last)` Add content.
    `void` | `complete()` Complete the message.
    `void` | `completeHeader(HttpFields fields, boolean allContentAdded)`
    `int` | `flushBuffer()`
    `int` | `getBytesBuffered()`
    `static Buffer` | `getReasonBuffer(int code)`
    `boolean` | `isBufferFull()`
    `boolean` | `isEmpty()`
    `boolean` | `isRequest()`
    `boolean` | `isResponse()`
    `int` | `prepareUncheckedAddContent()` Prepare buffer for unchecked writes.
    `void` | `reset()`
    `void` | `send1xx(int code)`
    `void` | `sendResponse(Buffer response)` send complete response.
    `static void` | `setServerVersion(java.lang.String version)`
    `java.lang.String` | `toString()`

    - ### Methods inherited from class org.eclipse.jetty.http.AbstractGenerator

      `blockForOutput, completeUncheckedAddContent, flush, getContentBufferSize, getContentWritten, getSendServerVersion, getState, getUncheckedBuffer, getVersion, increaseContentBufferSize, isAllContentWritten, isCommitted, isComplete, isHead, isIdle, isOpen, isPersistent, isState, isWritten, resetBuffer, returnBuffers, sendError, setContentLength, setDate, setHead, setPersistent, setRequest, setResponse, setSendServerVersion, setVersion`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### _bypass

          protected boolean _bypass

  - ### Constructor Detail

    - #### HttpGenerator

          public HttpGenerator(Buffers buffers,
                       EndPoint io)

      Constructor.
      Parameters:
        `buffers` - buffer pool
        `io` - the end point to use

  - ### Method Detail

    - #### getReasonBuffer

          public static Buffer getReasonBuffer(int code)

    - #### setServerVersion

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

    - #### reset

          public void reset()

      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`

    - #### prepareUncheckedAddContent

          public 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`

    - #### send1xx

          public void send1xx(int code)
                       throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### isRequest

          public boolean isRequest()

      Specified by:
        `isRequest` in class `AbstractGenerator`

    - #### isResponse

          public boolean isResponse()

      Specified by:
        `isResponse` 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`

    - #### flushBuffer

          public int flushBuffer()
                          throws java.io.IOException

      Specified by:
        `flushBuffer` in interface `Generator`
      Specified by:
        `flushBuffer` 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`

Copyright © 2013 FuseSource, Corp.. All Rights Reserved.