|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.slamd.http.HTTPRequest
This class defines a means of encapsulating an HTTP request to send to a remote server. The request may use either the GET or POST method.
| Field Summary | |
static java.lang.String |
HTTP_METHOD_GET
The HTTP method for GET requests. |
static java.lang.String |
HTTP_METHOD_POST
The HTTP method for POST requests. |
| Constructor Summary | |
HTTPRequest(boolean isGet,
java.net.URL baseURL)
Creates a new HTTP request with the provided method and base URL. |
|
| Method Summary | |
void |
addEncodedParameter(java.lang.String name,
java.lang.String value)
Adds the provided parameter to this request with a value that is already properly URL-encoded. |
void |
addParameter(java.lang.String name,
java.lang.String value)
Adds the specified parameter to this request. |
void |
addParameter(java.lang.String name,
java.lang.String[] values)
Adds the specified parameter to this request. |
void |
clearHeaders()
Removes all header information for this request. |
HTTPRequest |
clone(java.net.URL baseURL)
Creates a new HTTP request that is a copy of this request, optionally using a different base URL. |
static java.lang.String |
encodeValue(java.lang.String parameterValue)
Encodes the provided value in a form suitable for including in an HTTP request. |
java.lang.String |
generateHTTPRequest(HTTPClient client)
Creates a string that is suitable for sending to an HTTP server or proxy. |
java.net.URL |
getBaseURL()
Retrieves the base URL for this request. |
java.lang.String |
getHeader(java.lang.String name)
Retrieves the value of the requested header for this request. |
java.util.LinkedHashMap |
getHeaderMap()
Retrieves the map containing information about the headers for this request. |
java.util.ArrayList |
getParameterNameList()
Retrieves an array list whose string elements are the names of the parameters associated with this request. |
java.lang.String[] |
getParameterNames()
Retrieves the names of the parameters for this request. |
java.lang.String |
getParameterValue(java.lang.String parameterName)
Retrieves the value of the parameter with the specified name. |
java.util.ArrayList |
getParameterValueList()
Retrieves an array list whose string elements are the values of the parameters associated with this request. |
java.lang.String[] |
getParameterValues()
Retrieves the values of the parameters for this request. |
java.lang.String[] |
getParameterValues(java.lang.String parameterName)
Retrieves the set of values for the parameter with the specified name. |
java.lang.String |
getRequestMethod()
Retrieves the HTTP method associated with this request. |
boolean |
isGet()
Indicates whether this is an HTTP GET request. |
void |
removeAllParameters()
Removes all parameter information from this request. |
void |
removeHeader(java.lang.String name)
Removes the header with the specified name from this request. |
void |
removeParameter(java.lang.String name)
Removes all values for the parameter with the given name. |
void |
removeParameter(java.lang.String name,
java.lang.String value)
Removes the parameter with the specified name and value from this request. |
void |
replaceParameter(java.lang.String name,
java.lang.String newValue)
Replaces any existing values for the specified parameter in this request with the provided value. |
void |
replaceParameter(java.lang.String name,
java.lang.String[] newValues)
Replaces any existing values for the specified parameter in this request with the provided set of values. |
void |
setHeader(java.lang.String name,
java.lang.String value)
Adds the provided name and value to the set of headers for this request. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String HTTP_METHOD_GET
public static final java.lang.String HTTP_METHOD_POST
| Constructor Detail |
public HTTPRequest(boolean isGet,
java.net.URL baseURL)
isGet - Indicates whether this request should use the HTTP GET
method (if not, POST will be used).baseURL - The base URL to use for the request.| Method Detail |
public boolean isGet()
true if this represents a GET request, or
false if it represents a POST request.public java.lang.String getRequestMethod()
public java.net.URL getBaseURL()
public java.lang.String getHeader(java.lang.String name)
null if no such header has been defined.public java.util.LinkedHashMap getHeaderMap()
public void setHeader(java.lang.String name,
java.lang.String value)
name - The name of the header to add to the request.value - The value of the header to add.public void removeHeader(java.lang.String name)
name - The name of the header to remove from this request.public void clearHeaders()
public java.util.ArrayList getParameterNameList()
public java.lang.String[] getParameterNames()
public java.util.ArrayList getParameterValueList()
public java.lang.String[] getParameterValues()
public java.lang.String getParameterValue(java.lang.String parameterName)
null will
be returned.
parameterName - The name of the parameter for which to retrieve the
value.
public java.lang.String[] getParameterValues(java.lang.String parameterName)
parameterName - The name of the parameter for which to retrieve the
set of values.
public void addParameter(java.lang.String name,
java.lang.String value)
name - The name of the value to add to this request.value - The value of the parameter to add to this request.
public void addEncodedParameter(java.lang.String name,
java.lang.String value)
throws java.io.UnsupportedEncodingException
name - The name to use for the parameter.value - The pre-encoded value to for the parameter.
java.io.UnsupportedEncodingException
public void addParameter(java.lang.String name,
java.lang.String[] values)
name - The name of the value to add to this request.values - The set of value for the parameter to add to this request.
public void replaceParameter(java.lang.String name,
java.lang.String newValue)
name - The name of the parameter for which to replace any
existing values.newValue - The new value to use in place of any existing value(s).
public void replaceParameter(java.lang.String name,
java.lang.String[] newValues)
name - The name of the parameter for which to replace any
existing values.newValues - The set of values to use in place of any existing
value(s).public void removeParameter(java.lang.String name)
name - The name of the header for which to remove any values from
the request.
public void removeParameter(java.lang.String name,
java.lang.String value)
name - The name of the parameter from which to remove the specified
value.value - The value of the parameter to remove.public void removeAllParameters()
public java.lang.String generateHTTPRequest(HTTPClient client)
client - The client that will be sending the request.
public static java.lang.String encodeValue(java.lang.String parameterValue)
parameterValue - The value to be encoded.
public HTTPRequest clone(java.net.URL baseURL)
baseURL - The base URL to use for the new request. If this is null
then the base URL from this request will be used.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||