org.eclipse.jetty.http
类 AbstractGenerator

java.lang.Object
  继承者 org.eclipse.jetty.http.AbstractGenerator
所有已实现的接口:
Generator
直接已知子类:
Ajp13Generator, HttpGenerator, NestedGenerator

public abstract class AbstractGenerator
extends 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.


字段摘要
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  Boolean _persistent
           
protected  Buffer _reason
           
protected  int _state
           
protected  int _status
           
protected  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
           
 
从接口 org.eclipse.jetty.http.Generator 继承的字段
LAST, MORE
 
构造方法摘要
AbstractGenerator(Buffers buffers, EndPoint io)
          Constructor.
 
方法摘要
 void blockForOutput(long maxIdleTime)
           
 void complete()
          Complete the message.
abstract  void completeHeader(HttpFields fields, boolean allContentAdded)
           
 void completeUncheckedAddContent()
           
 void flush(long maxIdleTime)
           
abstract  int 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()
           
 void resetBuffer()
           
 void returnBuffers()
           
 void sendError(int code, String reason, 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(String method, String uri)
           
 void setResponse(int status, String reason)
           
 void setSendServerVersion(boolean sendServerVersion)
           
 void setVersion(int version)
           
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
从接口 org.eclipse.jetty.http.Generator 继承的方法
addContent
 

字段详细信息

STATE_HEADER

public static final int STATE_HEADER
另请参见:
常量字段值

STATE_CONTENT

public static final int STATE_CONTENT
另请参见:
常量字段值

STATE_FLUSHING

public static final int STATE_FLUSHING
另请参见:
常量字段值

STATE_END

public static final int STATE_END
另请参见:
常量字段值

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 String _uri

_contentWritten

protected long _contentWritten

_contentLength

protected long _contentLength

_last

protected boolean _last

_head

protected boolean _head

_noContent

protected boolean _noContent

_persistent

protected Boolean _persistent

_header

protected Buffer _header

_buffer

protected Buffer _buffer

_content

protected Buffer _content

_date

protected Buffer _date
构造方法详细信息

AbstractGenerator

public AbstractGenerator(Buffers buffers,
                         EndPoint io)
Constructor.

参数:
buffers - buffer pool
io - the end point
方法详细信息

isRequest

public abstract boolean isRequest()

isResponse

public abstract boolean isResponse()

isOpen

public boolean isOpen()

reset

public void reset()
指定者:
接口 Generator 中的 reset

returnBuffers

public void returnBuffers()
指定者:
接口 Generator 中的 returnBuffers

resetBuffer

public void resetBuffer()
指定者:
接口 Generator 中的 resetBuffer

getContentBufferSize

public int getContentBufferSize()
指定者:
接口 Generator 中的 getContentBufferSize
返回:
Returns the contentBufferSize.

increaseContentBufferSize

public void increaseContentBufferSize(int contentBufferSize)
指定者:
接口 Generator 中的 increaseContentBufferSize
参数:
contentBufferSize - The contentBufferSize to set.

getUncheckedBuffer

public Buffer getUncheckedBuffer()

getSendServerVersion

public boolean getSendServerVersion()

setSendServerVersion

public void setSendServerVersion(boolean sendServerVersion)
指定者:
接口 Generator 中的 setSendServerVersion

getState

public int getState()

isState

public boolean isState(int state)

isComplete

public boolean isComplete()
指定者:
接口 Generator 中的 isComplete

isIdle

public boolean isIdle()
指定者:
接口 Generator 中的 isIdle

isCommitted

public boolean isCommitted()
指定者:
接口 Generator 中的 isCommitted

isHead

public boolean isHead()
返回:
Returns the head.

setContentLength

public void setContentLength(long value)
指定者:
接口 Generator 中的 setContentLength

setHead

public void setHead(boolean head)
指定者:
接口 Generator 中的 setHead
参数:
head - The head to set.

isPersistent

public boolean isPersistent()
指定者:
接口 Generator 中的 isPersistent
返回:
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)
指定者:
接口 Generator 中的 setPersistent

setVersion

public void setVersion(int version)
指定者:
接口 Generator 中的 setVersion
参数:
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)
指定者:
接口 Generator 中的 setDate
另请参见:
Generator.setDate(org.eclipse.jetty.io.Buffer)

setRequest

public void setRequest(String method,
                       String uri)
指定者:
接口 Generator 中的 setRequest

setResponse

public void setResponse(int status,
                        String reason)
指定者:
接口 Generator 中的 setResponse
参数:
status - The status code to send.
reason - the status message to send.

prepareUncheckedAddContent

public abstract int prepareUncheckedAddContent()
                                        throws IOException
Prepare buffer for unchecked writes. Prepare the generator buffer to receive unchecked writes

返回:
the available space in the buffer.
抛出:
IOException

completeUncheckedAddContent

public void completeUncheckedAddContent()

isBufferFull

public boolean isBufferFull()
指定者:
接口 Generator 中的 isBufferFull

isWritten

public boolean isWritten()
指定者:
接口 Generator 中的 isWritten

isAllContentWritten

public boolean isAllContentWritten()
指定者:
接口 Generator 中的 isAllContentWritten

completeHeader

public abstract void completeHeader(HttpFields fields,
                                    boolean allContentAdded)
                             throws IOException
指定者:
接口 Generator 中的 completeHeader
抛出:
IOException

complete

public void complete()
              throws IOException
Complete the message.

指定者:
接口 Generator 中的 complete
抛出:
IOException

flushBuffer

public abstract int flushBuffer()
                         throws IOException
指定者:
接口 Generator 中的 flushBuffer
抛出:
IOException

flush

public void flush(long maxIdleTime)
           throws IOException
抛出:
IOException

sendError

public void sendError(int code,
                      String reason,
                      String content,
                      boolean close)
               throws 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.

指定者:
接口 Generator 中的 sendError
参数:
code - The error code
reason - The error reason
content - Contents of the error page
close - True if the connection should be closed
抛出:
IOException - if there is a problem flushing the response

getContentWritten

public long getContentWritten()
指定者:
接口 Generator 中的 getContentWritten
返回:
Returns the contentWritten.

blockForOutput

public void blockForOutput(long maxIdleTime)
                    throws IOException
抛出:
IOException


Copyright © 2013. All Rights Reserved.