org.mortbay.jetty
public abstract class AbstractGenerator extends java.lang.Object implements Generator
Modifier and Type | Class and Description |
---|---|
static class |
AbstractGenerator.Output
Output.
|
static class |
AbstractGenerator.OutputWriter
OutputWriter.
|
Modifier and Type | Field and Description |
---|---|
protected Buffer |
_buffer |
protected Buffers |
_buffers |
protected boolean |
_close |
protected Buffer |
_content |
protected int |
_contentBufferSize |
protected long |
_contentLength |
protected long |
_contentWritten |
protected EndPoint |
_endp |
protected boolean |
_head |
protected Buffer |
_header |
protected int |
_headerBufferSize |
protected boolean |
_last |
protected Buffer |
_method |
protected boolean |
_noContent |
protected Buffer |
_reason |
protected int |
_state |
protected int |
_status |
protected java.lang.String |
_uri |
protected int |
_version |
static int |
STATE_CONTENT |
static int |
STATE_END |
static int |
STATE_FLUSHING |
static int |
STATE_HEADER |
Constructor and Description |
---|
AbstractGenerator(Buffers buffers,
EndPoint io,
int headerBufferSize,
int contentBufferSize)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
complete()
Complete the message.
|
abstract void |
completeHeader(HttpFields fields,
boolean allContentAdded) |
abstract long |
flush() |
int |
getContentBufferSize() |
long |
getContentWritten() |
static java.lang.String |
getReason(int code) |
protected static Buffer |
getReasonBuffer(int code) |
boolean |
getSendServerVersion() |
int |
getState() |
Buffer |
getUncheckedBuffer() |
int |
getVersion() |
void |
increaseContentBufferSize(int contentBufferSize) |
boolean |
isBufferFull() |
boolean |
isCommitted() |
boolean |
isComplete() |
boolean |
isContentWritten() |
boolean |
isHead() |
boolean |
isIdle() |
boolean |
isPersistent() |
boolean |
isState(int state) |
protected 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 |
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) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addContent, addContent
public static final int STATE_HEADER
public static final int STATE_CONTENT
public static final int STATE_FLUSHING
public static final int STATE_END
protected int _state
protected int _status
protected int _version
protected Buffer _reason
protected Buffer _method
protected java.lang.String _uri
protected long _contentWritten
protected long _contentLength
protected boolean _last
protected boolean _head
protected boolean _noContent
protected boolean _close
protected Buffers _buffers
protected EndPoint _endp
protected int _headerBufferSize
protected int _contentBufferSize
protected Buffer _header
protected Buffer _buffer
protected Buffer _content
protected static Buffer getReasonBuffer(int code)
public static java.lang.String getReason(int code)
public void resetBuffer()
resetBuffer
in interface Generator
public int getContentBufferSize()
getContentBufferSize
in interface Generator
public void increaseContentBufferSize(int contentBufferSize)
increaseContentBufferSize
in interface Generator
contentBufferSize
- The contentBufferSize to set.public Buffer getUncheckedBuffer()
public boolean getSendServerVersion()
public void setSendServerVersion(boolean sendServerVersion)
setSendServerVersion
in interface Generator
public int getState()
public boolean isState(int state)
public boolean isComplete()
isComplete
in interface Generator
public boolean isCommitted()
isCommitted
in interface Generator
public boolean isHead()
public void setContentLength(long value)
setContentLength
in interface Generator
public void setHead(boolean head)
public boolean isPersistent()
isPersistent
in interface Generator
false
if the connection should be closed after a request has been read,
true
if it should be used for additional requests.public void setPersistent(boolean persistent)
setPersistent
in interface Generator
public void setVersion(int version)
setVersion
in interface Generator
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).public int getVersion()
public void setRequest(java.lang.String method, java.lang.String uri)
setRequest
in interface Generator
public void setResponse(int status, java.lang.String reason)
setResponse
in interface Generator
status
- The status code to send.reason
- the status message to send.protected abstract int prepareUncheckedAddContent() throws java.io.IOException
java.io.IOException
public boolean isBufferFull()
isBufferFull
in interface Generator
public boolean isContentWritten()
isContentWritten
in interface Generator
public abstract void completeHeader(HttpFields fields, boolean allContentAdded) throws java.io.IOException
completeHeader
in interface Generator
java.io.IOException
public void complete() throws java.io.IOException
public abstract long flush() throws java.io.IOException
public void sendError(int code, java.lang.String reason, java.lang.String content, boolean close) throws java.io.IOException
public long getContentWritten()
getContentWritten
in interface Generator
Copyright © 2009 Mortbay Consulting Pty. Ltd. All Rights Reserved.