public class WebRequestSettings extends Object implements Serializable
Constructor and Description |
---|
WebRequestSettings(URL url)
Instantiates a
WebRequestSettings for the specified URL. |
WebRequestSettings(URL url,
HttpMethod submitMethod)
Instantiates a
WebRequestSettings for the specified URL using the specified HTTP submit method. |
WebRequestSettings(WebRequestSettings originalRequest,
URL url)
Instantiates a
WebRequestSettings for the specified URL using the proxy configuration from the
specified original request. |
Modifier and Type | Method and Description |
---|---|
void |
addAdditionalHeader(String name,
String value)
Deprecated.
As of 2.6, please use
setAdditionalHeader(String, String) instead |
Map<String,String> |
getAdditionalHeaders()
Returns the additional HTTP headers to use.
|
String |
getCharset()
Returns the character set to use to perform the request.
|
org.apache.commons.httpclient.auth.CredentialsProvider |
getCredentialsProvider()
Returns the credentials provider to use.
|
FormEncodingType |
getEncodingType()
Returns the form encoding type to use.
|
HttpMethod |
getHttpMethod()
Returns the HTTP submit method to use.
|
String |
getProxyHost()
Returns the proxy host to use.
|
int |
getProxyPort()
Returns the proxy port to use.
|
String |
getRequestBody()
Returns the body content to be submitted if this is a POST request.
|
List<org.apache.commons.httpclient.NameValuePair> |
getRequestParameters()
Retrieves the request parameters to use.
|
URL |
getUrl()
Returns the target URL.
|
void |
removeAdditionalHeader(String name)
Removed the specified name/value pair from the additional HTTP headers.
|
void |
setAdditionalHeader(String name,
String value)
Sets the specified name/value pair in the additional HTTP headers.
|
void |
setAdditionalHeaders(Map<String,String> additionalHeaders)
Sets the additional HTTP headers to use.
|
void |
setCharset(String charset)
Sets the character set to use to perform the request.
|
void |
setCredentialsProvider(org.apache.commons.httpclient.auth.CredentialsProvider credentialsProvider)
Sets the credentials provider to use.
|
void |
setEncodingType(FormEncodingType encodingType)
Sets the form encoding type to use.
|
void |
setHttpMethod(HttpMethod submitMethod)
Sets the HTTP submit method to use.
|
void |
setProxyHost(String proxyHost)
Sets the proxy host to use.
|
void |
setProxyPort(int proxyPort)
Sets the proxy port to use.
|
void |
setRequestBody(String requestBody)
Sets the body content to be submitted if this is a POST request.
|
void |
setRequestParameters(List<org.apache.commons.httpclient.NameValuePair> requestParameters)
Sets the request parameters to use.
|
void |
setUrl(URL url)
Sets the target URL.
|
String |
toString()
Returns a string representation of this object.
|
public WebRequestSettings(URL url)
WebRequestSettings
for the specified URL.url
- the target URLpublic WebRequestSettings(WebRequestSettings originalRequest, URL url)
WebRequestSettings
for the specified URL using the proxy configuration from the
specified original request.originalRequest
- the original requesturl
- the target URLpublic WebRequestSettings(URL url, HttpMethod submitMethod)
WebRequestSettings
for the specified URL using the specified HTTP submit method.url
- the target URLsubmitMethod
- the HTTP submit method to usepublic URL getUrl()
public void setUrl(URL url)
url
- the target URLpublic String getProxyHost()
public void setProxyHost(String proxyHost)
proxyHost
- the proxy host to usepublic int getProxyPort()
public void setProxyPort(int proxyPort)
proxyPort
- the proxy port to usepublic FormEncodingType getEncodingType()
public void setEncodingType(FormEncodingType encodingType)
encodingType
- the form encoding type to usepublic List<org.apache.commons.httpclient.NameValuePair> getRequestParameters()
URL
. Should not be used in
combination with the request body
.public void setRequestParameters(List<org.apache.commons.httpclient.NameValuePair> requestParameters) throws RuntimeException
URL
. Should not be used in combination
with the request body
.requestParameters
- the request parameters to useRuntimeException
- if the request body has already been setpublic String getRequestBody()
request parameters
.public void setRequestBody(String requestBody) throws RuntimeException
request parameters
.requestBody
- the body content to be submitted if this is a POST requestRuntimeException
- if the request parameters have already been set or this is not a POST requestpublic HttpMethod getHttpMethod()
public void setHttpMethod(HttpMethod submitMethod)
submitMethod
- the HTTP submit method to usepublic Map<String,String> getAdditionalHeaders()
public void setAdditionalHeaders(Map<String,String> additionalHeaders)
additionalHeaders
- the additional HTTP headers to usepublic void setAdditionalHeader(String name, String value)
name
- the name of the additional HTTP headervalue
- the value of the additional HTTP header@Deprecated public void addAdditionalHeader(String name, String value)
setAdditionalHeader(String, String)
insteadname
- the name of the additional HTTP headervalue
- the value of the additional HTTP headerpublic void removeAdditionalHeader(String name)
name
- the name of the additional HTTP headerpublic org.apache.commons.httpclient.auth.CredentialsProvider getCredentialsProvider()
public void setCredentialsProvider(org.apache.commons.httpclient.auth.CredentialsProvider credentialsProvider)
credentialsProvider
- the credentials provider to usepublic String getCharset()
public void setCharset(String charset)
TextUtil.DEFAULT_CHARSET
.charset
- the character set to use to perform the requestCopyright © 2002–2014 Gargoyle Software Inc.. All rights reserved.