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.eclipse.jetty.http
Class AbstractGenerator

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

All Implemented Interfaces:
  Generator

Direct Known Subclasses:
  Ajp13Generator, HttpGenerator

    public abstract class AbstractGenerator

extends java.lang.Object
implements Generator

Abstract Generator. Builds HTTP Messages. Currently this class uses a system parameter "jetty.direct.writers" to control two optional writer to byte conversions. buffer.writers=true will probably be faster, but will consume more memory. This option is just for testing and tuning.

Field Summary
`protected Buffer` | `_buffer`
`protected Buffers` | `_buffers`
`protected Buffer` | `_content`
`protected long` | `_contentLength`
`protected long` | `_contentWritten`
`protected Buffer` | `_date`
`protected EndPoint` | `_endp`
`protected boolean` | `_head`
`protected Buffer` | `_header`
`protected boolean` | `_last`
`protected Buffer` | `_method`
`protected boolean` | `_noContent`
`protected java.lang.Boolean` | `_persistent`
`protected Buffer` | `_reason`
`protected int` | `_state`
`protected int` | `_status`
`protected java.lang.String` | `_uri`
`protected int` | `_version`
`static byte[]` | `NO_BYTES`
`static int` | `STATE_CONTENT`
`static int` | `STATE_END`
`static int` | `STATE_FLUSHING`
`static int` | `STATE_HEADER`

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

Constructor Summary
`AbstractGenerator(Buffers buffers, EndPoint io)` Constructor.

Method Summary
`void` | `blockForOutput(long maxIdleTime)`
`void` | `complete()` Complete the message.
`abstract void` | `completeHeader(HttpFields fields, boolean allContentAdded)`
`void` | `completeUncheckedAddContent()`
`void` | `flush(long maxIdleTime)`
`abstract long` | `flushBuffer()`
`int` | `getContentBufferSize()`
`long` | `getContentWritten()`
`boolean` | `getSendServerVersion()`
`int` | `getState()`
`Buffer` | `getUncheckedBuffer()`
`int` | `getVersion()`
`void` | `increaseContentBufferSize(int contentBufferSize)`
`boolean` | `isAllContentWritten()`
`boolean` | `isBufferFull()`
`boolean` | `isCommitted()`
`boolean` | `isComplete()`
`boolean` | `isHead()`
`boolean` | `isIdle()`
`boolean` | `isOpen()`
`boolean` | `isPersistent()`
`abstract boolean` | `isRequest()`
`abstract boolean` | `isResponse()`
`boolean` | `isState(int state)`
`boolean` | `isWritten()`
`abstract int` | `prepareUncheckedAddContent()` Prepare buffer for unchecked writes.
`void` | `reset(boolean returnBuffers)`
`void` | `resetBuffer()`
`void` | `sendError(int code, java.lang.String reason, java.lang.String content, boolean close)` Utility method to send an error response.
`void` | `setContentLength(long value)`
`void` | `setDate(Buffer timeStampBuffer)`
`void` | `setHead(boolean head)`
`void` | `setPersistent(boolean persistent)`
`void` | `setRequest(java.lang.String method, java.lang.String uri)`
`void` | `setResponse(int status, java.lang.String reason)`
`void` | `setSendServerVersion(boolean sendServerVersion)`
`void` | `setVersion(int version)`

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

Methods inherited from interface org.eclipse.jetty.http.Generator
`addContent, addContent`

Field Detail

### STATE_HEADER

    public static final int STATE_HEADER

See Also:
  Constant Field Values

### STATE_CONTENT

    public static final int STATE_CONTENT

See Also:
  Constant Field Values

### STATE_FLUSHING

    public static final int STATE_FLUSHING

See Also:
  Constant Field Values

### STATE_END

    public static final int STATE_END

See Also:
  Constant Field Values

### NO_BYTES

    public static final byte[] NO_BYTES

### _buffers

    protected final Buffers _buffers

### _endp

    protected final EndPoint _endp

### _state

    protected int _state

### _status

    protected int _status

### _version

    protected int _version

### _reason

    protected Buffer _reason

### _method

    protected Buffer _method

### _uri

    protected java.lang.String _uri

### _contentWritten

    protected long _contentWritten

### _contentLength

    protected long _contentLength

### _last

    protected boolean _last

### _head

    protected boolean _head

### _noContent

    protected boolean _noContent

### _persistent

    protected java.lang.Boolean _persistent

### _header

    protected Buffer _header

### _buffer

    protected Buffer _buffer

### _content

    protected Buffer _content

### _date

    protected Buffer _date

Constructor Detail

### AbstractGenerator

    public AbstractGenerator(Buffers buffers,
                             EndPoint io)

  Constructor.

  Parameters:
    `buffers` - buffer pool
    `io` - the end point

Method Detail

### isRequest

    public abstract boolean isRequest()

### isResponse

    public abstract boolean isResponse()

### isOpen

    public boolean isOpen()

### reset

    public void reset(boolean returnBuffers)

  Specified by:
    `reset` in interface `Generator`

### resetBuffer

    public void resetBuffer()

  Specified by:
    `resetBuffer` in interface `Generator`

### getContentBufferSize

    public int getContentBufferSize()

  Specified by:
    `getContentBufferSize` in interface `Generator`
  Returns:
    Returns the contentBufferSize.

### increaseContentBufferSize

    public void increaseContentBufferSize(int contentBufferSize)

  Specified by:
    `increaseContentBufferSize` in interface `Generator`
  Parameters:
    `contentBufferSize` - The contentBufferSize to set.

### getUncheckedBuffer

    public Buffer getUncheckedBuffer()

### getSendServerVersion

    public boolean getSendServerVersion()

### setSendServerVersion

    public void setSendServerVersion(boolean sendServerVersion)

  Specified by:
    `setSendServerVersion` in interface `Generator`

### getState

    public int getState()

### isState

    public boolean isState(int state)

### isComplete

    public boolean isComplete()

  Specified by:
    `isComplete` in interface `Generator`

### isIdle

    public boolean isIdle()

  Specified by:
    `isIdle` in interface `Generator`

### isCommitted

    public boolean isCommitted()

  Specified by:
    `isCommitted` in interface `Generator`

### isHead

    public boolean isHead()

  Returns:
    Returns the head.

### setContentLength

    public void setContentLength(long value)

  Specified by:
    `setContentLength` in interface `Generator`

### setHead

    public void setHead(boolean head)

  Specified by:
    `setHead` in interface `Generator`
  Parameters:
    `head` - The head to set.

### isPersistent

    public boolean isPersistent()

  Specified by:
    `isPersistent` in interface `Generator`
  Returns:
    `false` if the connection should be closed after a request has been read, `true` if it should be used for additional requests.

### setPersistent

    public void setPersistent(boolean persistent)

  Specified by:
    `setPersistent` in interface `Generator`

### setVersion

    public void setVersion(int version)

  Specified by:
    `setVersion` in interface `Generator`
  Parameters:
    `version` - The version of the client the response is being sent to (NB. Not the version in the response, which is the version of the server).

### getVersion

    public int getVersion()

### setDate

    public void setDate(Buffer timeStampBuffer)

  Specified by:
    `setDate` in interface `Generator`
  See Also:
    `Generator.setDate(org.eclipse.jetty.io.Buffer)`

### setRequest

    public void setRequest(java.lang.String method,
                           java.lang.String uri)

  Specified by:
    `setRequest` in interface `Generator`

### setResponse

    public void setResponse(int status,
                            java.lang.String reason)

  Specified by:
    `setResponse` in interface `Generator`
  Parameters:
    `status` - The status code to send.
    `reason` - the status message to send.

### prepareUncheckedAddContent

    public abstract int prepareUncheckedAddContent()
                                            throws java.io.IOException

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

  Returns:
    the available space in the buffer.
  Throws:
    `java.io.IOException`

### completeUncheckedAddContent

    public void completeUncheckedAddContent()

### isBufferFull

    public boolean isBufferFull()

  Specified by:
    `isBufferFull` in interface `Generator`

### isWritten

    public boolean isWritten()

  Specified by:
    `isWritten` in interface `Generator`

### isAllContentWritten

    public boolean isAllContentWritten()

  Specified by:
    `isAllContentWritten` in interface `Generator`

### completeHeader

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

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

### complete

    public void complete()
                  throws java.io.IOException

  Complete the message.

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

### flushBuffer

    public abstract long flushBuffer()
                              throws java.io.IOException

  Specified by:
    `flushBuffer` in interface `Generator`
  Throws:
    `java.io.IOException`

### flush

    public void flush(long maxIdleTime)
               throws java.io.IOException

  Throws:
    `java.io.IOException`

### sendError

    public void sendError(int code,
                          java.lang.String reason,
                          java.lang.String content,
                          boolean close)
                   throws java.io.IOException

  Utility method to send an error response. If the builder is not committed, this call is equivalent to a setResponse, addContent and complete call.

  Specified by:
    `sendError` in interface `Generator`
  Parameters:
    `code` - The error code
    `reason` - The error reason
    `content` - Contents of the error page
    `close` - True if the connection should be closed
  Throws:
    `java.io.IOException` - if there is a problem flushing the response

### getContentWritten

    public long getContentWritten()

  Specified by:
    `getContentWritten` in interface `Generator`
  Returns:
    Returns the contentWritten.

### blockForOutput

    public void blockForOutput(long maxIdleTime)
                        throws java.io.IOException

  Throws:
    `java.io.IOException`

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.