public class WebClientOptions extends Object implements Serializable
WebClient
.Constructor and Description |
---|
WebClientOptions() |
Modifier and Type | Method and Description |
---|---|
String |
getHomePage()
Returns the client's current homepage.
|
int |
getMaxInMemory()
Returns the maximum bytes to have in memory, after which the content is saved to a file.
|
boolean |
getPrintContentOnFailingStatusCode()
Returns
true if the content of the resulting document will be printed to
the console in the event of a failing response code. |
ProxyConfig |
getProxyConfig()
Returns the proxy configuration for this client.
|
char[] |
getSSLClientCertificatePassword()
Gets the SSLClientCertificatePassword.
|
KeyStore |
getSSLClientCertificateStore()
Gets the SSLClientCertificateStore.
|
String[] |
getSSLClientCipherSuites()
Gets the cipher suites enabled for use on SSL connections.
|
String[] |
getSSLClientProtocols()
Gets the protocol versions enabled for use on SSL connections.
|
String |
getSSLInsecureProtocol()
Gets the SSL protocol, to be used only when
setUseInsecureSSL(boolean) is set to true . |
KeyStore |
getSSLTrustStore()
Gets the SSL TrustStore.
|
int |
getTimeout()
Gets the timeout value for the
WebConnection . |
boolean |
isActiveXNative()
Returns whether native ActiveX components are allowed or no.
|
boolean |
isAppletEnabled()
Returns
true if Applet are enabled. |
boolean |
isCssEnabled()
Returns
true if CSS is enabled. |
boolean |
isDoNotTrackEnabled()
Returns
true if "Do Not Track" is enabled. |
boolean |
isGeolocationEnabled()
Returns
true if Geolocation is enabled. |
boolean |
isJavaScriptEnabled()
Returns
true if JavaScript is enabled and the script engine was loaded successfully. |
boolean |
isPopupBlockerEnabled()
Returns
true if the popup window blocker is enabled. |
boolean |
isRedirectEnabled()
Returns whether or not redirections will be followed automatically on receipt of
a redirect status code from the server.
|
boolean |
isThrowExceptionOnFailingStatusCode()
Returns
true if an exception will be thrown in the event of a failing response code. |
boolean |
isThrowExceptionOnScriptError()
Indicates if an exception should be thrown when a script execution fails
(the default) or if it should be caught and just logged to allow page
execution to continue.
|
boolean |
isUseInsecureSSL()
Indicates if insecure SSL should be used.
|
void |
setActiveXNative(boolean allow)
Sets whether to allow native ActiveX or no.
|
void |
setAppletEnabled(boolean enabled)
Enables/disables Applet support.
|
void |
setCssEnabled(boolean enabled)
Enables/disables CSS support.
|
void |
setDoNotTrackEnabled(boolean enabled)
Enables/disables "Do Not Track" support.
|
void |
setGeolocationEnabled(boolean enabled)
Enables/disables Geolocation support.
|
void |
setHomePage(String homePage)
Sets the client's homepage.
|
void |
setJavaScriptEnabled(boolean enabled)
Enables/disables JavaScript support.
|
void |
setMaxInMemory(int maxInMemory)
Sets the maximum bytes to have in memory, after which the content is saved to a file.
|
void |
setPopupBlockerEnabled(boolean enabled)
Enable/disable the popup window blocker.
|
void |
setPrintContentOnFailingStatusCode(boolean enabled)
Specify whether or not the content of the resulting document will be
printed to the console in the event of a failing response code.
|
void |
setProxyConfig(ProxyConfig proxyConfig)
Sets the proxy configuration for this client.
|
void |
setRedirectEnabled(boolean enabled)
Sets whether or not redirections will be followed automatically on receipt of a redirect
status code from the server.
|
void |
setSSLClientCertificate(URL certificateUrl,
String certificatePassword,
String certificateType)
Sets the SSL client certificate to use.
|
void |
setSSLClientCipherSuites(String[] sslClientCipherSuites)
Sets the cipher suites enabled for use on SSL connections,
null to use default ones. |
void |
setSSLClientProtocols(String[] sslClientProtocols)
Sets the protocol versions enabled for use on SSL connections,
null to use default ones. |
void |
setSSLInsecureProtocol(String sslInsecureProtocol)
Sets the SSL protocol, used only when
setUseInsecureSSL(boolean) is set to true . |
void |
setSSLTrustStore(URL sslTrustStoreUrl,
String sslTrustStorePassword,
String sslTrustStoreType)
Sets the SSL server certificate trust store.
|
void |
setThrowExceptionOnFailingStatusCode(boolean enabled)
Specify whether or not an exception will be thrown in the event of a
failing status code.
|
void |
setThrowExceptionOnScriptError(boolean enabled)
Changes the behavior of this webclient when a script error occurs.
|
void |
setTimeout(int timeout)
Sets the timeout of the
WebConnection . |
void |
setUseInsecureSSL(boolean useInsecureSSL)
If set to
true , the client will accept connections to any host, regardless of
whether they have valid certificates or not. |
public void setUseInsecureSSL(boolean useInsecureSSL)
true
, the client will accept connections to any host, regardless of
whether they have valid certificates or not. This is especially useful when you are trying to
connect to a server with expired or corrupt certificates.useInsecureSSL
- whether or not to use insecure SSLpublic boolean isUseInsecureSSL()
true
if insecure SSL should be used. Default is false
.public void setRedirectEnabled(boolean enabled)
enabled
- true to enable automatic redirectionpublic boolean isRedirectEnabled()
public void setSSLClientCertificate(URL certificateUrl, String certificatePassword, String certificateType)
KeyStore
.
If the web server requires Renegotiation, you have to set system property
"sun.security.ssl.allowUnsafeRenegotiation" to true, as hinted in
TLS Renegotiation Issue.certificateUrl
- the URL which locates the certificatecertificatePassword
- the certificate passwordcertificateType
- the type of certificate, usually "jks" or "pkcs12".public KeyStore getSSLClientCertificateStore()
public char[] getSSLClientCertificatePassword()
public String[] getSSLClientProtocols()
setSSLClientProtocols(String[])
public void setSSLClientProtocols(String[] sslClientProtocols)
null
to use default ones.sslClientProtocols
- the protocol versionsSSLSocket.setEnabledProtocols(String[])
,
getSSLClientProtocols()
public String[] getSSLClientCipherSuites()
setSSLClientCipherSuites(String[])
public void setSSLClientCipherSuites(String[] sslClientCipherSuites)
null
to use default ones.sslClientCipherSuites
- the cipher suitesSSLSocket.setEnabledCipherSuites(String[])
,
getSSLClientCipherSuites()
public void setJavaScriptEnabled(boolean enabled)
enabled
- true
to enable JavaScript supportpublic boolean isJavaScriptEnabled()
true
if JavaScript is enabled and the script engine was loaded successfully.true
if JavaScript is enabledpublic void setCssEnabled(boolean enabled)
enabled
- true
to enable CSS supportpublic boolean isCssEnabled()
true
if CSS is enabled.true
if CSS is enabledpublic void setAppletEnabled(boolean enabled)
Note: as of HtmlUnit-2.4, Applet support is experimental and minimal
enabled
- true
to enable Applet supportpublic boolean isAppletEnabled()
true
if Applet are enabled.true
if Applet is enabledpublic void setPopupBlockerEnabled(boolean enabled)
true
, window.open() has no effect and
returns null
.enabled
- true
to enable the popup window blockerpublic boolean isPopupBlockerEnabled()
true
if the popup window blocker is enabled.true
if the popup window blocker is enabledpublic void setGeolocationEnabled(boolean enabled)
enabled
- true
to enable Geolocation supportpublic boolean isGeolocationEnabled()
true
if Geolocation is enabled.true
if Geolocation is enabledpublic void setDoNotTrackEnabled(boolean enabled)
enabled
- true
to enable "Do Not Track" supportpublic boolean isDoNotTrackEnabled()
true
if "Do Not Track" is enabled.true
if "Do Not Track" is enabledpublic void setPrintContentOnFailingStatusCode(boolean enabled)
enabled
- True to enable this featurepublic boolean getPrintContentOnFailingStatusCode()
true
if the content of the resulting document will be printed to
the console in the event of a failing response code.true
if the content of the resulting document will be printed to
the console in the event of a failing response codesetPrintContentOnFailingStatusCode(boolean)
public void setThrowExceptionOnFailingStatusCode(boolean enabled)
enabled
- true
to enable this featurepublic boolean isThrowExceptionOnFailingStatusCode()
true
if an exception will be thrown in the event of a failing response code.true
if an exception will be thrown in the event of a failing response codesetThrowExceptionOnFailingStatusCode(boolean)
public boolean isThrowExceptionOnScriptError()
true
if an exception is thrown on script error (the default)public void setThrowExceptionOnScriptError(boolean enabled)
enabled
- indicates if exception should be thrown or notpublic void setActiveXNative(boolean allow)
allow
- whether to allow or nopublic boolean isActiveXNative()
public String getHomePage()
public void setHomePage(String homePage)
homePage
- the new homepage URLpublic ProxyConfig getProxyConfig()
public void setProxyConfig(ProxyConfig proxyConfig)
proxyConfig
- the proxy configuration for this clientpublic int getTimeout()
WebConnection
.
The default timeout is 90 seconds (it was 0 up to HtmlUnit-2.11).setTimeout(int)
public void setTimeout(int timeout)
Sets the timeout of the WebConnection
. Set to zero for an infinite wait.
Note: The timeout is used twice. The first is for making the socket connection, the second is for data retrieval. If the time is critical you must allow for twice the time specified here.
timeout
- the value of the timeout in millisecondspublic void setSSLInsecureProtocol(String sslInsecureProtocol)
setUseInsecureSSL(boolean)
is set to true
.sslInsecureProtocol
- the SSL protocol for insecure SSL connections,
null
to use for default valuepublic String getSSLInsecureProtocol()
setUseInsecureSSL(boolean)
is set to true
.public void setSSLTrustStore(URL sslTrustStoreUrl, String sslTrustStorePassword, String sslTrustStoreType)
KeyStore
.sslTrustStoreUrl
- the URL which locates the trust storesslTrustStorePassword
- the trust store passwordsslTrustStoreType
- the type of trust store, usually "jks" or "pkcs12".public KeyStore getSSLTrustStore()
public int getMaxInMemory()
public void setMaxInMemory(int maxInMemory)
maxInMemory
- maximum bytes in memoryCopyright © 2002–2017 Gargoyle Software Inc.. All rights reserved.