Package sonia.scm.net
Class HttpConnectionOptions
java.lang.Object
sonia.scm.net.HttpConnectionOptions
Options for establishing a http connection.
The options can be used to create a new http connection
with
HttpURLConnectionFactory.create(URL, HttpConnectionOptions)
.- Since:
- 2.23.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddRequestProperty
(String key, String value) Add a request property that will be converted to headers in the request.Return optional array of key managers for client certificate authentication.Returns optional local proxy configuration.withConnectionTimeout
(long timeout, TimeUnit unit) Configure the connection timeout.Disable certificate validation.Disable hostname validation.Ignore proxy settings completely regardless if a local proxy configuration or a global configuration is configured.withKeyManagers
(KeyManager... keyManagers) Configure key managers for client certificate authentication.withProxyConfiguration
(ProxyConfiguration proxyConfiguration) Configure a local proxy configuration, if no configuration is set the global default configuration will be used.withReadTimeout
(long timeout, TimeUnit unit) Configure the read timeout.
-
Constructor Details
-
HttpConnectionOptions
public HttpConnectionOptions()
-
-
Method Details
-
getProxyConfiguration
Returns optional local proxy configuration.- Returns:
- local proxy configuration or empty optional
-
getKeyManagers
Return optional array of key managers for client certificate authentication.- Returns:
- array of key managers or empty optional
-
getConnectionProperties
-
withDisableCertificateValidation
Disable certificate validation. WARNING: This option should only be used for internal test. It should never be used in production, because it is high security risk.- Returns:
this
-
withDisabledHostnameValidation
Disable hostname validation. WARNING: This option should only be used for internal test. It should never be used in production, because it is high security risk.- Returns:
this
-
withConnectionTimeout
Configure the connection timeout.- Parameters:
timeout
- timeoutunit
- unit of the timeout- Returns:
this
-
withReadTimeout
Configure the read timeout.- Parameters:
timeout
- timeoutunit
- unit of the timeout- Returns:
this
-
withProxyConfiguration
Configure a local proxy configuration, if no configuration is set the global default configuration will be used.- Parameters:
proxyConfiguration
- local proxy configuration- Returns:
this
-
withKeyManagers
Configure key managers for client certificate authentication.- Parameters:
keyManagers
- key managers- Returns:
this
-
withIgnoreProxySettings
Ignore proxy settings completely regardless if a local proxy configuration or a global configuration is configured.- Returns:
this
-
addRequestProperty
Add a request property that will be converted to headers in the request.- Parameters:
key
- The property (aka header) name (e.g. "User-Agent").value
- The value of the property.- Returns:
this
-