public abstract class HttpConfigurationBuilder extends java.lang.Object implements ComponentConfigurer<HttpConfiguration>
If you want to set non-default values for any of these properties, create a builder with
Components.httpConfiguration()
, change its properties with the methods of this class,
and pass it to LDConfig.Builder.http(ComponentConfigurer)
:
LDConfig config = new LDConfig.Builder()
.http(
Components.httpConfiguration()
.connectTimeoutMillis(3000)
.proxyHostAndPort("my-proxy", 8080)
)
.build();
Note that this class is abstract; the actual implementation is created by calling Components.httpConfiguration()
.
Modifier and Type | Field and Description |
---|---|
protected java.time.Duration |
connectTimeout |
protected java.util.Map<java.lang.String,java.lang.String> |
customHeaders |
static java.time.Duration |
DEFAULT_CONNECT_TIMEOUT
The default value for
connectTimeout(Duration) : two seconds. |
static java.time.Duration |
DEFAULT_SOCKET_TIMEOUT
The default value for
socketTimeout(Duration) : 10 seconds. |
protected HttpAuthentication |
proxyAuth |
protected java.lang.String |
proxyHost |
protected int |
proxyPort |
protected javax.net.SocketFactory |
socketFactory |
protected java.time.Duration |
socketTimeout |
protected javax.net.ssl.SSLSocketFactory |
sslSocketFactory |
protected javax.net.ssl.X509TrustManager |
trustManager |
protected java.lang.String |
wrapperName |
protected java.lang.String |
wrapperVersion |
Constructor and Description |
---|
HttpConfigurationBuilder() |
Modifier and Type | Method and Description |
---|---|
HttpConfigurationBuilder |
addCustomHeader(java.lang.String headerName,
java.lang.String headerValue)
Specifies a custom HTTP header that should be added to all SDK requests.
|
HttpConfigurationBuilder |
connectTimeout(java.time.Duration connectTimeout)
Sets the connection timeout.
|
HttpConfigurationBuilder |
proxyAuth(HttpAuthentication strategy)
Sets an authentication strategy for use with an HTTP proxy.
|
HttpConfigurationBuilder |
proxyHostAndPort(java.lang.String host,
int port)
Sets an HTTP proxy for making connections to LaunchDarkly.
|
HttpConfigurationBuilder |
socketFactory(javax.net.SocketFactory socketFactory)
Specifies a custom socket configuration for HTTP connections to LaunchDarkly.
|
HttpConfigurationBuilder |
socketTimeout(java.time.Duration socketTimeout)
Sets the socket timeout.
|
HttpConfigurationBuilder |
sslSocketFactory(javax.net.ssl.SSLSocketFactory sslSocketFactory,
javax.net.ssl.X509TrustManager trustManager)
Specifies a custom security configuration for HTTPS connections to LaunchDarkly.
|
HttpConfigurationBuilder |
wrapper(java.lang.String wrapperName,
java.lang.String wrapperVersion)
For use by wrapper libraries to set an identifying name for the wrapper being used.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
build
public static final java.time.Duration DEFAULT_CONNECT_TIMEOUT
connectTimeout(Duration)
: two seconds.public static final java.time.Duration DEFAULT_SOCKET_TIMEOUT
socketTimeout(Duration)
: 10 seconds.protected java.time.Duration connectTimeout
protected HttpAuthentication proxyAuth
protected java.lang.String proxyHost
protected java.util.Map<java.lang.String,java.lang.String> customHeaders
protected int proxyPort
protected java.time.Duration socketTimeout
protected javax.net.SocketFactory socketFactory
protected javax.net.ssl.SSLSocketFactory sslSocketFactory
protected javax.net.ssl.X509TrustManager trustManager
protected java.lang.String wrapperName
protected java.lang.String wrapperVersion
public HttpConfigurationBuilder connectTimeout(java.time.Duration connectTimeout)
The default is DEFAULT_CONNECT_TIMEOUT
.
connectTimeout
- the connection timeout; null to use the defaultpublic HttpConfigurationBuilder proxyHostAndPort(java.lang.String host, int port)
host
- the proxy hostnameport
- the proxy portpublic HttpConfigurationBuilder proxyAuth(HttpAuthentication strategy)
proxyHostAndPort(String, int)
.strategy
- the authentication strategypublic HttpConfigurationBuilder socketTimeout(java.time.Duration socketTimeout)
Components.streamingDataSource()
, which has its own
non-configurable read timeout based on the expected behavior of the LaunchDarkly streaming service.
The default is DEFAULT_SOCKET_TIMEOUT
.
socketTimeout
- the socket timeout; null to use the defaultpublic HttpConfigurationBuilder socketFactory(javax.net.SocketFactory socketFactory)
This uses the standard Java interfaces for configuring socket connections.
socketFactory
- the socket factorypublic HttpConfigurationBuilder sslSocketFactory(javax.net.ssl.SSLSocketFactory sslSocketFactory, javax.net.ssl.X509TrustManager trustManager)
This uses the standard Java interfaces for configuring secure socket connections and certificate verification.
sslSocketFactory
- the SSL socket factorytrustManager
- the trust managerpublic HttpConfigurationBuilder addCustomHeader(java.lang.String headerName, java.lang.String headerValue)
This may be helpful if you are using a gateway or proxy server that requires a specific header in requests. You may add any number of headers.
headerName
- standard HTTP headerheaderValue
- standard HTTP valuepublic HttpConfigurationBuilder wrapper(java.lang.String wrapperName, java.lang.String wrapperVersion)
wrapperName
- an identifying name for the wrapper librarywrapperVersion
- version string for the wrapper library