|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
This class is a mirror image of HttpConnection but defines some additional functionality for server side.
| Method Summary | ||
String |
getHeaderField(int n)
Gets a header field value by index. |
|
String |
getHeaderField(String name)
Returns the value of the named header field. |
|
int |
getHeaderFieldInt(String name,
int def)
Returns the value of the named field parsed as a number. |
|
String |
getHeaderFieldKey(int n)
Gets a header field key by index. |
|
String |
getRequestMethod()
Get the current request method. e.g. |
|
String |
getRequestURI()
Returns the requested URI. |
|
String |
getResponseProperty(String key)
Returns the value of the named general response property for this connection. |
|
String |
getVersion()
Returns the HTTP version. |
|
void |
setResponseCode(int code)
Sets the HTTP response status code. |
|
void |
setResponseProperty(String key,
String value)
Sets the general response property. |
|
| Methods inherited from interface javax.microedition.io.ContentConnection |
getEncoding, getLength, getType |
| Methods inherited from interface javax.microedition.io.InputConnection |
openDataInputStream, openInputStream |
| Methods inherited from interface javax.microedition.io.Connection |
close |
| Methods inherited from interface javax.microedition.io.OutputConnection |
openDataOutputStream, openOutputStream |
| Method Detail |
public String getHeaderField(int n) throws IOException
n - the index of the header fieldnull if the array index is out of range.
An empty String is returned if the field does not have a value.IOException - if an error occurred connecting to the client.public String getHeaderField(String name) throws IOException
name - of a header field.null
if there is no such field in the header.IOException - if an error occurred connecting to the client.public int getHeaderFieldInt(String name, int def) throws IOException
This form of getHeaderField exists because some
connection types (e.g., http-ng) have pre-parsed
headers. Classes for that connection type can override this method
and short-circuit the parsing.
name - the name of the header field.def - the default value.def value is returned if the field is
missing or malformed.IOException - if an error occurred connecting to the client.public String getHeaderFieldKey(int n) throws IOException
n - the index of the header fieldnull if the array index is out of range.IOException - if an error occurred connecting to the client.public String getRequestMethod() throws IOException
public String getRequestURI() throws IOException
public String getResponseProperty(String key) throws IOException
key - the keyword by which the response property is
known (e.g., "accept").null is returned.setResponseProperty(java.lang.String, java.lang.String)public String getVersion() throws IOException
public void setResponseCode(int code)
throws IOException
code - The response code to send to the client.IOException - if an error occurred connecting to the client.public void setResponseProperty(String key, String value) throws IOException
Note: HTTP requires all response properties which can legally have multiple instances with the same key to use a comma-separated list syntax which enables multiple properties to be appended into a single property.
key - the keyword by which the response is known
(e.g., "accept").value - the value associated with it.IOException - is thrown if the connection is in the
connected state.getResponseProperty(java.lang.String)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2008 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.