|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.mortbay.jetty.HttpGenerator
HttpGenerator. Builds HTTP Messages.
Nested Class Summary | |
static class |
HttpGenerator.Output
Output. |
static class |
HttpGenerator.OutputWriter
OutputWriter. |
Field Summary | |
static boolean |
LAST
|
static boolean |
MORE
|
static int |
STATE_CONTENT
|
static int |
STATE_END
|
static int |
STATE_FLUSHING
|
static int |
STATE_HEADER
|
Fields inherited from interface org.mortbay.jetty.HttpTokens |
CARRIAGE_RETURN, CHUNKED_CONTENT, COLON, CRLF, EOF_CONTENT, LINE_FEED, NO_CONTENT, SELF_DEFINING_CONTENT, SEMI_COLON, SPACE, TAB, UNKNOWN_CONTENT |
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 |
flushBuffers()
|
int |
getContentBufferSize()
|
long |
getContentWritten()
|
static String |
getReason(int code)
|
boolean |
getSendServerVersion()
|
int |
getState()
|
Buffer |
getUncheckedBuffer()
|
void |
increaseContentBufferSize(int contentBufferSize)
|
boolean |
isBufferFull()
|
boolean |
isCommitted()
|
boolean |
isComplete()
|
boolean |
isHead()
|
boolean |
isPersistent()
|
boolean |
isState(int state)
|
void |
reset(boolean returnBuffers)
|
void |
resetBuffer()
|
void |
sendError(int code,
String reason,
String content,
boolean close)
Utility method to send an error response. |
void |
setHead(boolean head)
|
void |
setRequest(Buffer method,
Buffer uri)
|
void |
setResponse(int status,
String reason)
|
void |
setSendServerVersion(boolean sendServerVersion)
|
static void |
setServerVersion(String version)
|
void |
setVersion(int version)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int STATE_HEADER
public static final int STATE_CONTENT
public static final int STATE_FLUSHING
public static final int STATE_END
public static final boolean LAST
public static final boolean MORE
Constructor Detail |
public HttpGenerator(Buffers buffers, EndPoint io, int headerBufferSize, int contentBufferSize)
buffers
- buffer poolheaderBufferSize
- Size of the buffer to allocate for HTTP headercontentBufferSize
- Size of the buffer to allocate for HTTP contentMethod Detail |
public static void setServerVersion(String version)
public static String getReason(int code)
public void reset(boolean returnBuffers)
public void resetBuffer()
public Buffer getUncheckedBuffer()
public boolean getSendServerVersion()
public void setSendServerVersion(boolean sendServerVersion)
public int getState()
public boolean isState(int state)
public boolean isComplete()
public boolean isCommitted()
public boolean isHead()
public void setHead(boolean head)
head
- The head to set.public boolean isPersistent()
false
if the connection should be closed after a request has been read,
true
if it should be used for additional requests.public void setVersion(int version)
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 void setRequest(Buffer method, Buffer uri)
public void setResponse(int status, String reason)
status
- The status code to send.reason
- the status message to send.public void addContent(Buffer content, boolean last) throws IOException
content
- last
-
IllegalArgumentException
- if content
is immutable
.
IllegalStateException
- If the request is not expecting any more content,
or if the buffers are full and cannot be flushed.
IOException
- if there is a problem flushing the buffers.public boolean addContent(byte b) throws IOException
b
- byte
IOException
public boolean isBufferFull()
public void completeHeader(HttpFields fields, boolean allContentAdded) throws IOException
IOException
public void complete() throws IOException
IOException
public long flushBuffers() throws IOException
IOException
public void sendError(int code, String reason, String content, boolean close) throws IOException
code
- reason
- content
- close
-
IOException
public int getContentBufferSize()
public void increaseContentBufferSize(int contentBufferSize)
contentBufferSize
- The contentBufferSize to set.public long getContentWritten()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |