|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IHTTPMessage
A HTTP request/response message.
Field Summary | |
---|---|
static char |
CR
|
static int |
DEFAULT_INITIAL_BUFFER_SIZE
|
static char |
HT
|
static int |
INIT_NUM_HEADERS
|
static char |
LF
|
static char |
SP
|
Method Summary | |
---|---|
void |
addTrailingHeader(IHTTPHeader trailer)
Adds a HTTP trailing header. |
IHTTPHeader |
getHeader(byte[] name)
Gets a HTTP header of the specified name. |
byte[] |
getHeaderAsBytes(byte[] name)
Gets value of a HTTP header as an array of bytes. |
List<IHTTPHeader> |
getHeaders()
Gets all HTTP headers defined in this HTTP message. |
byte[] |
getHTTPVersionAsBytes()
Gets the value of HTTP version as an array of bytes. |
String |
getHTTPVersionAsString()
Gets the value of HTTP version as a String. |
IMessageBody |
getMessageBody()
Gets the body of this HTTP message. |
long |
getSerial()
|
long |
getTid()
Gets the TID assigned to this message. |
boolean |
isChunkedEncoding()
Returns whether the encoding of this message is chunked or not. |
boolean |
isConnectionToBeClosed()
Tells that the connection for exchanging this message needs to be closed or not. |
boolean |
isHTTPVersion1_1()
Returns whether the HTTP protocol version of this message is 1.1 or not. |
IHTTPHeader |
removeHeader(byte[] name)
Removes a HTTP header of the specified name. |
void |
setChunkedEncoding(boolean isChunked)
Sets whether this message is in chunked encoding. |
void |
setConnectionHeader(boolean keepalive)
Sets "Connection" HTTP header for this message. |
void |
setHeader(byte[] name,
byte[] value)
Updates value of a HTTP header, or a HTTP header is added if no HTTP header of the specified name is defined. |
void |
setTid(long tid)
Sets the TID for this message. |
void |
write(long timeout,
OutputStream out)
Writes this message (headers and message body) to the specified output stream. |
void |
writeBody(long timeout,
IMessageBody msgBody,
OutputStream out)
Writes the message body to the specified output stream. |
Field Detail |
---|
static final int INIT_NUM_HEADERS
static final int DEFAULT_INITIAL_BUFFER_SIZE
static final char CR
static final char LF
static final char SP
static final char HT
Method Detail |
---|
long getSerial()
String getHTTPVersionAsString()
byte[] getHTTPVersionAsBytes()
IMessageBody getMessageBody()
List<IHTTPHeader> getHeaders()
IHTTPHeader removeHeader(byte[] name)
name
- name of a HTTP header
void setHeader(byte[] name, byte[] value)
name
- name of HTTP headervalue
- value of HTTP headervoid addTrailingHeader(IHTTPHeader trailer)
trailer
- a HTTP trailing headerIHTTPHeader getHeader(byte[] name)
name
- name of a HTTP header
byte[] getHeaderAsBytes(byte[] name)
name
- name of a HTTP header
boolean isChunkedEncoding()
void setChunkedEncoding(boolean isChunked)
isChunked
- whether this message is in chunked encodingvoid setTid(long tid)
tid
- TID as a long valuelong getTid()
void writeBody(long timeout, IMessageBody msgBody, OutputStream out) throws IOException, TimeoutException
timeout
- number of milliseconds to wait until the write operation is done, or 0 if it does not need to timeoutmsgBody
- message body to be writtenout
- an output stream to which the message body is written
IOException
TimeoutException
- if it failed to write the message body within the specified timevoid write(long timeout, OutputStream out) throws IOException, TimeoutException
timeout
- number of milliseconds to wait until the write operation is done, or 0 if it does not need to timeoutout
- an output stream to which this message is written
IOException
TimeoutException
- if it failed to write this message within the specified timeboolean isHTTPVersion1_1()
void setConnectionHeader(boolean keepalive)
keepalive
- true to set the value of "Connection" header to "Keep-Alive", false to set the value of "Connection header to "close"IHTTPHeader.CONNECTION
boolean isConnectionToBeClosed()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |