org.mortbay.http
public abstract class HttpMessage extends Object
Version: $Id: HttpMessage.java,v 1.41 2006/04/04 22:28:02 gregwilkins Exp $
Nested Class Summary | |
---|---|
interface | HttpMessage.HeaderWriter |
Field Summary | |
---|---|
protected Map | _attributes |
protected String | _characterEncoding |
protected HttpConnection | _connection |
protected int | _dotVersion |
protected HttpFields | _header |
protected String | _mimeType |
protected int | _state |
protected String | _version |
protected Object | _wrapper |
static String | __HTTP_0_9 |
static String | __HTTP_1_0 |
static String | __HTTP_1_1 |
static 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 String[] | __state |
static String | __SCHEME |
static String | __SSL_SCHEME |
Constructor Summary | |
---|---|
protected | HttpMessage() Constructor. |
protected | HttpMessage(HttpConnection connection) Constructor. |
Method Summary | |
---|---|
void | addDateField(String name, Date date) Adds the value of a date field.
|
void | addDateField(String name, long date) Add the value of a date field.
|
void | addField(String name, String value) Add to a multi-value field value.
|
void | addIntField(String name, int value) Adds the value of an integer field.
|
boolean | containsField(String name) Does the header or trailer contain a field? |
void | destroy() Destroy the message.
|
Object | getAttribute(String name) Get a request attribute. |
Enumeration | getAttributeNames() Get Attribute names. |
String | getCharacterEncoding() Character Encoding.
|
int | getContentLength() |
String | getContentType() |
long | getDateField(String name) Get a header as a date value.
|
int | getDotVersion() Get the protocol version. |
String | getField(String name) Get a message field.
|
Enumeration | getFieldNames() Get field names. |
Enumeration | getFieldValues(String name) Get a multi valued message field.
|
Enumeration | getFieldValues(String name, String separators) Get a multi valued message field.
|
HttpFields | getHeader() Get the HTTP header fields. |
HttpConnection | getHttpConnection() |
InputStream | getInputStream() |
int | getIntField(String name) Get a field as an integer value.
|
String | getMimeType() Mime Type.
|
OutputStream | getOutputStream() |
int | getState() Get the message state.
|
String | getVersion() Get the protocol version. |
Object | getWrapper() Get an associated wrapper object. |
boolean | isCommitted() |
boolean | isDirty() |
void | removeAttribute(String name) Remove a request attribute. |
String | removeField(String name) Remove a field.
|
protected void | reset() |
Object | setAttribute(String name, Object attribute) Set a request attribute. |
void | setCharacterEncoding(String encoding, boolean setField) Set Character Encoding. |
void | setContentLength(int len) |
void | setContentType(String contentType) |
void | setDateField(String name, Date date) Sets the value of a date field.
|
void | setDateField(String name, long date) Sets the value of a date field.
|
String | setField(String name, String value) Set a field value.
|
void | setField(String name, List value) Set a multi-value field value.
|
void | setIntField(String name, int value) Sets the value of an integer field.
|
int | setState(int state) Set the message state.
|
void | setVersion(String version) Set the request version |
void | setWrapper(Object wrapper) Set a wrapper object.
|
String | toString() Convert to String.
|
void | updateMimeType() |
Parameters: name the field name date the field date value
Parameters: name the field name date the field date value
Throws: IllegalStateException Not editable or sending 1.1 with trailers
Parameters: name Name of field value New value to add to the field
Throws: IllegalStateException Not editable or sending 1.1 with trailers
Parameters: name the field name value the field integer value
Parameters: name Name of the field
Returns: True if contained in header or trailer.
Parameters: name Attribute name
Returns: Attribute value
Returns: Enumeration of Strings
Returns: Character Encoding or null
Parameters: name the case-insensitive field name
Returns: return the version dot (0.9=-1 1.0=0 1.1=1)
Parameters: name The field name
Returns: field value or null
Returns: Enumeration of Field Names
Parameters: name The field name
Returns: Enumeration of field values or null
Parameters: name The field name separators String of separators.
Returns: Enumeration of field values or null
Returns: Header or null
Parameters: name the case-insensitive field name
Returns: Content type without parameters
__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.
Returns: the state.
Returns: return the version.
Returns: Wrapper message or null.
Returns: true if the message has been modified.
Parameters: name Attribute name
Parameters: name Name of field
Returns: Old value of field
Parameters: name Attribute name attribute Attribute value
Returns: Previous Attribute value
Parameters: encoding An encoding that can override the encoding set from the ContentType field.
Parameters: name the field name date the field date value
Parameters: name the field name date the field date value
Parameters: name Name of field value New value of field
Returns: Old value of field
Parameters: name Name of field value New values of field
Parameters: name the field name value the field integer value
Parameters: state The new state
Returns: the last state.
Parameters: version the HTTP version string (eg HTTP/1.1)
Throws: IllegalStateException message is not EDITABLE
Returns: String