com.gargoylesoftware.htmlunit
Class WebRequestSettings

java.lang.Object
  extended by com.gargoylesoftware.htmlunit.WebRequestSettings

public class WebRequestSettings
extends java.lang.Object

Parameter object for making web requests

Version:
$Revision: 1.3 $
Author:
Brad Clarke, Hans Donner, Ahmed Ashour

Constructor Summary
WebRequestSettings(java.net.URL target)
  
WebRequestSettings(java.net.URL target, SubmitMethod submitMethod)
  
WebRequestSettings(WebRequestSettings originalRequest, java.net.URL target)
 Instantiate a WebRequestSettings for the given url using the proxy configuration from the original request
 
Method Summary
 void addAdditionalHeader(java.lang.String name, java.lang.String value)
 Adds the specified name/value pair to the additional headers.
 java.util.Map getAdditionalHeaders()
  
 java.lang.String getCharset()
 Gets the charset to use to perform the request
 java.lang.String getCookiePolicy()
 Gets the cookie policy to use to perform the request.
 org.apache.commons.httpclient.auth.CredentialsProvider getCredentialsProvider()
  
 FormEncodingType getEncodingType()
  
 java.lang.String getProxyHost()
  
 int getProxyPort()
  
 java.lang.String getRequestBody()
 Returns the body content to be submitted if this is a POST request.
 java.util.List getRequestParameters()
  
 SubmitMethod getSubmitMethod()
  
 java.net.URL getURL()
  
 void setAdditionalHeaders(java.util.Map additionalHeaders)
  
 void setCharset(java.lang.String charset)
 Sets the charset.
 void setCookiePolicy(java.lang.String cookiePolicy)
 Sets the cookie policy.
 void setCredentialsProvider(org.apache.commons.httpclient.auth.CredentialsProvider credentialsProvider)
  
 void setEncodingType(FormEncodingType encodingType)
  
 void setProxyHost(java.lang.String proxyHost)
  
 void setProxyPort(int proxyPort)
  
 void setRequestBody(java.lang.String requestBody)
  
 void setRequestParameters(java.util.List requestParameters)
  
 void setSubmitMethod(SubmitMethod submitMethod)
  
 void setURL(java.net.URL url)
  
 java.lang.String toString()
 Return a string representation of this object
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WebRequestSettings

public WebRequestSettings(java.net.URL target)
Parameters:
target - The URL for this request

WebRequestSettings

public WebRequestSettings(java.net.URL target,
                          SubmitMethod submitMethod)
Parameters:
target - The URL for this request
submitMethod - The submitMethod to set.

WebRequestSettings

public WebRequestSettings(WebRequestSettings originalRequest,
                          java.net.URL target)
Instantiate a WebRequestSettings for the given url using the proxy configuration from the original request

Parameters:
originalRequest - the original request
target - The URL for this request
Method Detail

addAdditionalHeader

public void addAdditionalHeader(java.lang.String name,
                                java.lang.String value)
Adds the specified name/value pair to the additional headers.

Parameters:
name - The name of the additional header.
value - The value of the additional header.

getAdditionalHeaders

public java.util.Map getAdditionalHeaders()
Returns:
Returns the additionalHeaders.

getCharset

public java.lang.String getCharset()
Gets the charset to use to perform the request

Returns:
the charset.

getCookiePolicy

public java.lang.String getCookiePolicy()
Gets the cookie policy to use to perform the request.

Returns:
the cookie policy.

getCredentialsProvider

public org.apache.commons.httpclient.auth.CredentialsProvider getCredentialsProvider()
Returns:
Returns the credentialsProvider.

getEncodingType

public FormEncodingType getEncodingType()
Returns:
Returns the encodingType.

getProxyHost

public java.lang.String getProxyHost()
Returns:
The proxy host.

getProxyPort

public int getProxyPort()
Returns:
The proxy port.

getRequestBody

public java.lang.String getRequestBody()
Returns the body content to be submitted if this is a POST request. Ignored for all other request types. Should not be used in combination with parameters.

Returns:
The body content to be submitted if this is a POST request.

getRequestParameters

public java.util.List getRequestParameters()
Returns:
Returns the requestParameters.

getSubmitMethod

public SubmitMethod getSubmitMethod()
Returns:
Returns the submitMethod.

getURL

public java.net.URL getURL()
Returns:
the URL

setAdditionalHeaders

public void setAdditionalHeaders(java.util.Map additionalHeaders)
Parameters:
additionalHeaders - The additionalHeaders to set.

setCharset

public void setCharset(java.lang.String charset)
Sets the charset. Default value is TextUtil.DEFAULT_CHARSET

Parameters:
charset - the new charset

setCookiePolicy

public void setCookiePolicy(java.lang.String cookiePolicy)
Sets the cookie policy. Default value is CookiePolicy.DEFAULT

Parameters:
cookiePolicy - the new cookie policy.

setCredentialsProvider

public void setCredentialsProvider(org.apache.commons.httpclient.auth.CredentialsProvider credentialsProvider)
Parameters:
credentialsProvider - The credentialProvider to set.

setEncodingType

public void setEncodingType(FormEncodingType encodingType)
Parameters:
encodingType - The encodingType to set.

setProxyHost

public void setProxyHost(java.lang.String proxyHost)
Parameters:
proxyHost - The new proxy host.

setProxyPort

public void setProxyPort(int proxyPort)
Parameters:
proxyPort - The new proxy port.

setRequestBody

public void setRequestBody(java.lang.String requestBody)
                    throws java.lang.RuntimeException
Parameters:
requestBody - The body content to be submitted if this is a POST request.
Throws:
java.lang.RuntimeException - If the request parameters have already been set or this is not a POST request.

setRequestParameters

public void setRequestParameters(java.util.List requestParameters)
                          throws java.lang.RuntimeException
Parameters:
requestParameters - The requestParameters to set.
Throws:
java.lang.RuntimeException - If the request body has already been set.

setSubmitMethod

public void setSubmitMethod(SubmitMethod submitMethod)
Parameters:
submitMethod - The submitMethod to set.

setURL

public void setURL(java.net.URL url)
Parameters:
url - The new URL

toString

public java.lang.String toString()
Return a string representation of this object

Overrides:
toString in class java.lang.Object
Returns:
See above


Copyright © 2003-2016 AppPerfect Corporation. All Rights Reserved.