Class HttpConfiguration
- java.lang.Object
-
- com.launchdarkly.sdk.server.subsystems.HttpConfiguration
-
public final class HttpConfiguration extends java.lang.Object
Encapsulates top-level HTTP configuration that applies to all SDK components.Use
HttpConfigurationBuilder
to construct an instance.The SDK's built-in components use OkHttp as the HTTP client implementation, but since OkHttp types are not surfaced in the public API and custom components might use some other implementation, this class only provides the properties that would be used to create an HTTP client; it does not create the client itself. SDK implementation code uses its own helper methods to do so.
- Since:
- 4.13.0
-
-
Constructor Summary
Constructors Constructor Description HttpConfiguration(java.time.Duration connectTimeout, java.util.Map<java.lang.String,java.lang.String> defaultHeaders, java.net.Proxy proxy, HttpAuthentication proxyAuthentication, javax.net.SocketFactory socketFactory, java.time.Duration socketTimeout, javax.net.ssl.SSLSocketFactory sslSocketFactory, javax.net.ssl.X509TrustManager trustManager)
Creates an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.time.Duration
getConnectTimeout()
The connection timeout.java.lang.Iterable<java.util.Map.Entry<java.lang.String,java.lang.String>>
getDefaultHeaders()
Returns the basic headers that should be added to all HTTP requests from SDK components to LaunchDarkly services, based on the current SDK configuration.java.net.Proxy
getProxy()
The proxy configuration, if any.HttpAuthentication
getProxyAuthentication()
The authentication method to use for a proxy, if any.javax.net.SocketFactory
getSocketFactory()
The configured socket factory for insecure connections.java.time.Duration
getSocketTimeout()
The socket timeout.javax.net.ssl.SSLSocketFactory
getSslSocketFactory()
The configured socket factory for secure connections.javax.net.ssl.X509TrustManager
getTrustManager()
The configured trust manager for secure connections, if custom certificate verification is needed.
-
-
-
Constructor Detail
-
HttpConfiguration
public HttpConfiguration(java.time.Duration connectTimeout, java.util.Map<java.lang.String,java.lang.String> defaultHeaders, java.net.Proxy proxy, HttpAuthentication proxyAuthentication, javax.net.SocketFactory socketFactory, java.time.Duration socketTimeout, javax.net.ssl.SSLSocketFactory sslSocketFactory, javax.net.ssl.X509TrustManager trustManager)
Creates an instance.- Parameters:
connectTimeout
- seegetConnectTimeout()
defaultHeaders
- seegetDefaultHeaders()
proxy
- seegetProxy()
proxyAuthentication
- seegetProxyAuthentication()
socketFactory
- seegetSocketFactory()
socketTimeout
- seegetSocketTimeout()
sslSocketFactory
- seegetSslSocketFactory()
trustManager
- seegetTrustManager()
-
-
Method Detail
-
getConnectTimeout
public java.time.Duration getConnectTimeout()
The connection timeout. This is the time allowed for the underlying HTTP client to connect to the LaunchDarkly server.- Returns:
- the connection timeout; never null
-
getDefaultHeaders
public java.lang.Iterable<java.util.Map.Entry<java.lang.String,java.lang.String>> getDefaultHeaders()
Returns the basic headers that should be added to all HTTP requests from SDK components to LaunchDarkly services, based on the current SDK configuration.- Returns:
- a list of HTTP header names and values
-
getProxy
public java.net.Proxy getProxy()
The proxy configuration, if any.- Returns:
- a
Proxy
instance or null
-
getProxyAuthentication
public HttpAuthentication getProxyAuthentication()
The authentication method to use for a proxy, if any. Ignored ifgetProxy()
is null.- Returns:
- an
HttpAuthentication
implementation or null
-
getSocketTimeout
public java.time.Duration getSocketTimeout()
The socket timeout. This is the amount of time without receiving data on a connection that the SDK will tolerate before signaling an error. This does not apply to the streaming connection used byComponents.streamingDataSource()
, which has its own non-configurable read timeout based on the expected behavior of the LaunchDarkly streaming service.- Returns:
- the socket timeout; never null
-
getSocketFactory
public javax.net.SocketFactory getSocketFactory()
The configured socket factory for insecure connections.- Returns:
- a SocketFactory or null
-
getSslSocketFactory
public javax.net.ssl.SSLSocketFactory getSslSocketFactory()
The configured socket factory for secure connections.- Returns:
- a SSLSocketFactory or null
-
getTrustManager
public javax.net.ssl.X509TrustManager getTrustManager()
The configured trust manager for secure connections, if custom certificate verification is needed.- Returns:
- an X509TrustManager or null
-
-