|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnetapp.manage.http.HTTPMessage
This class represents a HTTP message.
| Field Summary | |
protected byte[] |
_contents
|
protected java.util.Map |
_header
|
protected java.util.Map |
_headerLowerCase
|
protected int |
_version
|
static int |
METHOD_GET
A constant that specifies the HTTP GET method. |
static int |
METHOD_POST
A constant that specifies the HTTP POST method. |
static int |
VERSION_1_0
A constant that specifies version HTTP/1.0. |
static int |
VERSION_1_1
A constant that specifies version HTTP/1.1. |
| Constructor Summary | |
protected |
HTTPMessage(int version)
Constructs a HTTPMessage. |
| Method Summary | |
protected abstract java.lang.String |
firstLine()
Get the first (status) line of this HTTP message. |
byte[] |
getContents()
Return the contents of the message body of this message. |
java.lang.String |
getHeader(java.lang.String key)
Return the contents of one HTTP header from this message. |
protected java.lang.String |
headersString()
Get the HTTP headers. |
protected static int |
methodFromString(java.lang.String s)
Parse a HTTP method string |
protected static java.lang.String |
methodToString(int method)
Get the string representation of a HTTP method. |
protected void |
processHeaderLine(java.lang.String line)
Set a header based on a line of text. |
protected void |
readContents(java.io.InputStream in)
Read the message-body of this message. |
protected static java.lang.String |
readLine(java.io.InputStream in)
Read one line of text. |
java.lang.String |
removeHeader(java.lang.String key)
Remove one HTTP header from this message. |
void |
setContents(byte[] contents)
Set the contents of the message-body of this message. |
void |
setHeader(java.lang.String key,
java.lang.String value)
Set the contents of one HTTP header in this message. |
java.lang.String |
toString()
Return a String representation of this
HTTPMessage. |
protected static int |
versionFromString(java.lang.String s)
Parse a HTTP version string. |
protected static java.lang.String |
versionToString(int version)
Get the string representation of a HTTP version. |
void |
write(java.io.OutputStream out)
Write this message. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int VERSION_1_0
public static final int VERSION_1_1
public static final int METHOD_GET
public static final int METHOD_POST
protected int _version
protected java.util.Map _headerLowerCase
protected java.util.Map _header
protected byte[] _contents
| Constructor Detail |
protected HTTPMessage(int version)
HTTPMessage.
version - the HTTP version.| Method Detail |
public void setContents(byte[] contents)
contents - the message-body.public byte[] getContents()
public java.lang.String getHeader(java.lang.String key)
key - which HTTP header.
public void setHeader(java.lang.String key,
java.lang.String value)
key - which HTTP header.value - the new value of the header.public java.lang.String removeHeader(java.lang.String key)
key - which HTTP header.
protected static int versionFromString(java.lang.String s)
throws HTTPException
s - a version string.
VERSION_1_0 or
VERSION_1_1.
HTTPException - if the string is not a valid HTTP
version string.protected static java.lang.String versionToString(int version)
version - the version.
protected static int methodFromString(java.lang.String s)
throws HTTPException
s - a method string.
METHOD_GET or
METHOD_POST.
HTTPException - if the string is not a valid HTTP
method string.protected static java.lang.String methodToString(int method)
method - the method.
protected static java.lang.String readLine(java.io.InputStream in)
throws java.io.IOException
in - the input stream (which is presumably connected
to a HTTP socket).
java.io.IOException - if there is a communication problem on
the socket or if an invalid line terminator
is encountered.
protected void readContents(java.io.InputStream in)
throws java.io.IOException
in - the input stream (which is presumably connected
to a HTTP socket).
java.io.IOException - if there is a communication problem on
the socket.
public void write(java.io.OutputStream out)
throws java.io.IOException
out - the output stream stream (which is presumably
connected to a HTTP socket).
java.io.IOException - if there is a communication problem on
the socket.
protected void processHeaderLine(java.lang.String line)
throws HTTPException
line - a line of text.
HTTPException - if the line is not a valid HTTP header.protected abstract java.lang.String firstLine()
protected java.lang.String headersString()
public java.lang.String toString()
String representation of this
HTTPMessage. The first line (status line) plus the
HTTP headers are included in the string.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||