|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.mortbay.http.HttpMessage
HTTP Message base. This class forms the basis of HTTP requests and replies. It provides header fields, content and optional trailer fields, while managing the state of the message.
Nested Class Summary | |
static interface |
HttpMessage.HeaderWriter
|
Field Summary | |
static java.lang.String |
__HTTP_0_9
|
static java.lang.String |
__HTTP_1_0
|
static java.lang.String |
__HTTP_1_1
|
static java.lang.String |
__HTTP_1_X
|
static int |
__MSG_BAD
Message States. |
static int |
__MSG_EDITABLE
Message States. |
static int |
__MSG_RECEIVED
Message States. |
static int |
__MSG_SENDING
Message States. |
static int |
__MSG_SENT
Message States. |
static java.lang.String |
__SCHEME
|
static java.lang.String |
__SSL_SCHEME
|
static java.lang.String[] |
__state
|
Method Summary | |
boolean |
acceptTrailer()
Set if trailers are accepted. |
void |
addDateField(java.lang.String name,
java.util.Date date)
Adds the value of a date field. |
void |
addDateField(java.lang.String name,
long date)
Add the value of a date field. |
void |
addField(java.lang.String name,
java.lang.String value)
Add to a multi-value field value. |
void |
addIntField(java.lang.String name,
int value)
Adds the value of an integer field. |
boolean |
containsField(java.lang.String name)
Does the header or trailer contain a field? |
void |
destroy()
Destroy the message. |
java.lang.Object |
getAttribute(java.lang.String name)
Get a request attribute. |
java.util.Enumeration |
getAttributeNames()
Get Attribute names. |
java.lang.String |
getCharacterEncoding()
Character Encoding. |
int |
getContentLength()
|
java.lang.String |
getContentType()
|
long |
getDateField(java.lang.String name)
Get a header as a date value. |
int |
getDotVersion()
Get the protocol version. |
java.lang.String |
getField(java.lang.String name)
Get a message field. |
java.util.Enumeration |
getFieldNames()
Get field names. |
java.util.Enumeration |
getFieldValues(java.lang.String name)
Get a multi valued message field. |
java.util.Enumeration |
getFieldValues(java.lang.String name,
java.lang.String separators)
Get a multi valued message field. |
HttpFields |
getHeader()
Get the HTTP header fields. |
HttpConnection |
getHttpConnection()
|
java.io.InputStream |
getInputStream()
|
int |
getIntField(java.lang.String name)
Get a field as an integer value. |
java.lang.String |
getMimeType()
Mime Type. |
java.io.OutputStream |
getOutputStream()
|
int |
getState()
Get the message state. |
HttpFields |
getTrailer()
Get the HTTP chunked trailer (also called trailer). |
java.lang.String |
getVersion()
Get the protocol version. |
java.lang.Object |
getWrapper()
Get an associated wrapper object. |
boolean |
isCommitted()
|
boolean |
isDirty()
|
void |
removeAttribute(java.lang.String name)
Remove a request attribute. |
java.lang.String |
removeField(java.lang.String name)
Remove a field. |
void |
setAcceptTrailer(boolean acceptTrailer)
Set if trailers are accepted. |
java.lang.Object |
setAttribute(java.lang.String name,
java.lang.Object attribute)
Set a request attribute. |
void |
setCharacterEncoding(java.lang.String encoding)
Set Character Encoding. |
void |
setContentLength(int len)
|
void |
setContentType(java.lang.String contentType)
|
void |
setDateField(java.lang.String name,
java.util.Date date)
Sets the value of a date field. |
void |
setDateField(java.lang.String name,
long date)
Sets the value of a date field. |
void |
setField(java.lang.String name,
java.util.List value)
Set a multi-value field value. |
java.lang.String |
setField(java.lang.String name,
java.lang.String value)
Set a field value. |
void |
setIntField(java.lang.String name,
int value)
Sets the value of an integer field. |
int |
setState(int state)
Set the message state. |
void |
setVersion(java.lang.String version)
Set the request version |
void |
setWrapper(java.lang.Object wrapper)
Set a wrapper object. |
java.lang.String |
toString()
Convert to String. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String __SCHEME
public static final java.lang.String __SSL_SCHEME
public static final java.lang.String __HTTP_0_9
public static final java.lang.String __HTTP_1_0
public static final java.lang.String __HTTP_1_1
public static final java.lang.String __HTTP_1_X
public static final int __MSG_EDITABLE
public static final int __MSG_BAD
public static final int __MSG_RECEIVED
public static final int __MSG_SENDING
public static final int __MSG_SENT
public static final java.lang.String[] __state
Method Detail |
public void setWrapper(java.lang.Object wrapper)
public java.lang.Object getWrapper()
public HttpConnection getHttpConnection()
public java.io.InputStream getInputStream()
public java.io.OutputStream getOutputStream()
public int getState()
__MSG_EDITABLE = 0 - Created locally, all set methods enabled __MSG_BAD = 1 - Bad message or send failure. __MSG_RECEIVED = 2 - Received from connection. __MSG_SENDING = 3 - Headers sent. __MSG_SENT = 4 - Entity and trailers sent.
public int setState(int state)
state
- The new state
public java.lang.String getVersion()
public int getDotVersion()
public java.util.Enumeration getFieldNames()
public boolean containsField(java.lang.String name)
name
- Name of the field
public java.lang.String getField(java.lang.String name)
name
- The field name
public java.util.Enumeration getFieldValues(java.lang.String name)
name
- The field name
public java.util.Enumeration getFieldValues(java.lang.String name, java.lang.String separators)
name
- The field nameseparators
- String of separators.
public java.lang.String setField(java.lang.String name, java.lang.String value) throws java.lang.IllegalStateException
name
- Name of fieldvalue
- New value of field
java.lang.IllegalStateException
- Not editable or sending 1.1
with trailerspublic void setField(java.lang.String name, java.util.List value) throws java.lang.IllegalStateException
name
- Name of fieldvalue
- New values of field
java.lang.IllegalStateException
- Not editable or sending 1.1
with trailerspublic void addField(java.lang.String name, java.lang.String value) throws java.lang.IllegalStateException
name
- Name of fieldvalue
- New value to add to the field
java.lang.IllegalStateException
- Not editable or sending 1.1
with trailerspublic int getIntField(java.lang.String name)
name
- the case-insensitive field namepublic void setIntField(java.lang.String name, int value) throws java.lang.IllegalStateException
name
- the field namevalue
- the field integer value
java.lang.IllegalStateException
- Not editable or sending 1.1
with trailerspublic void addIntField(java.lang.String name, int value) throws java.lang.IllegalStateException
name
- the field namevalue
- the field integer value
java.lang.IllegalStateException
- Not editable or sending 1.1
with trailerspublic long getDateField(java.lang.String name)
name
- the case-insensitive field namepublic void setDateField(java.lang.String name, java.util.Date date)
name
- the field namedate
- the field date value
java.lang.IllegalStateException
- Not editable or sending 1.1
with trailerspublic void addDateField(java.lang.String name, java.util.Date date)
name
- the field namedate
- the field date value
java.lang.IllegalStateException
- Not editable or sending 1.1
with trailerspublic void setDateField(java.lang.String name, long date)
name
- the field namedate
- the field date value
java.lang.IllegalStateException
- Not editable or sending 1.1
with trailerspublic void addDateField(java.lang.String name, long date)
name
- the field namedate
- the field date value
java.lang.IllegalStateException
- Not editable or sending 1.1
with trailerspublic java.lang.String removeField(java.lang.String name) throws java.lang.IllegalStateException
name
- Name of field
java.lang.IllegalStateException
- Not editable or sending 1.1
with trailerspublic void setVersion(java.lang.String version)
version
- the HTTP version string (eg HTTP/1.1)
java.lang.IllegalStateException
- message is not EDITABLEpublic HttpFields getHeader()
public HttpFields getTrailer()
public void setAcceptTrailer(boolean acceptTrailer)
acceptTrailer
- If true, setField() may use trailers.public boolean acceptTrailer()
public java.lang.String getCharacterEncoding()
public void setCharacterEncoding(java.lang.String encoding)
encoding
- An encoding that can override the encoding set
from the ContentType field.public int getContentLength()
public void setContentLength(int len)
public java.lang.String getContentType()
public void setContentType(java.lang.String contentType)
public java.lang.String getMimeType()
public void destroy()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isCommitted()
public boolean isDirty()
public java.lang.Object getAttribute(java.lang.String name)
name
- Attribute name
public java.lang.Object setAttribute(java.lang.String name, java.lang.Object attribute)
name
- Attribute nameattribute
- Attribute value
public java.util.Enumeration getAttributeNames()
public void removeAttribute(java.lang.String name)
name
- Attribute name
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |