|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.gargoylesoftware.htmlunit.WebRequest
public class WebRequest
Parameter object for making web requests.
Constructor Summary | |
---|---|
WebRequest(URL url)
Instantiates a WebRequest for the specified URL. |
|
WebRequest(URL url,
HttpMethod submitMethod)
Instantiates a WebRequest for the specified URL using the specified HTTP submit method. |
|
WebRequest(WebRequest originalRequest,
URL url)
Instantiates a WebRequest for the specified URL using the proxy configuration from the
specified original request. |
Method Summary | |
---|---|
Map<String,String> |
getAdditionalHeaders()
Returns the additional HTTP headers to use. |
String |
getCharset()
Returns the character set to use to perform the request. |
Credentials |
getCredentials()
Returns the credentials 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<NameValuePair> |
getRequestParameters()
Retrieves the request parameters to use. |
URL |
getUrl()
Returns the target URL. |
Credentials |
getUrlCredentials()
Returns the credentials to use. |
boolean |
isAdditionalHeader(String name)
Returns whether the specified header name is already included in the additional HTTP headers. |
boolean |
isSocksProxy()
Returns whether SOCKS proxy or not. |
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 |
setCredentials(Credentials credentials)
Sets the credentials 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 or PUT request. |
void |
setRequestParameters(List<NameValuePair> requestParameters)
Sets the request parameters to use. |
void |
setSocksProxy(boolean isSocksProxy)
Sets whether SOCKS proxy or not. |
void |
setUrl(URL url)
Sets the target URL. |
String |
toString()
Returns a string representation of this object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public WebRequest(URL url)
WebRequest
for the specified URL.
url
- the target URLpublic WebRequest(WebRequest originalRequest, URL url)
WebRequest
for the specified URL using the proxy configuration from the
specified original request.
originalRequest
- the original requesturl
- the target URLpublic WebRequest(URL url, HttpMethod submitMethod)
WebRequest
for the specified URL using the specified HTTP submit method.
url
- the target URLsubmitMethod
- the HTTP submit method to useMethod Detail |
---|
public 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 boolean isSocksProxy()
public void setSocksProxy(boolean isSocksProxy)
isSocksProxy
- whether SOCKS proxy or notpublic FormEncodingType getEncodingType()
public void setEncodingType(FormEncodingType encodingType)
encodingType
- the form encoding type to usepublic List<NameValuePair> getRequestParameters()
URL
. Should not be used in
combination with the request body
.
public void setRequestParameters(List<NameValuePair> requestParameters) throws RuntimeException
URL
. Should not be used in combination
with the request body
.
requestParameters
- the request parameters to use
RuntimeException
- 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 request
RuntimeException
- if the request parameters have already been set
or this is not a POST or PUT 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 boolean isAdditionalHeader(String name)
name
- the name of the additional HTTP header
public void setAdditionalHeader(String name, String value)
name
- 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 Credentials getUrlCredentials()
public Credentials getCredentials()
public void setCredentials(Credentials credentials)
credentials
- the credentials to usepublic String getCharset()
public void setCharset(String charset)
TextUtil.DEFAULT_CHARSET
.
charset
- the character set to use to perform the requestpublic String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |