Class HttpConfigurationBuilder

java.lang.Object
com.launchdarkly.sdk.server.integrations.HttpConfigurationBuilder
All Implemented Interfaces:
HttpConfigurationFactory

public abstract class HttpConfigurationBuilder
extends java.lang.Object
implements HttpConfigurationFactory
Contains methods for configuring the SDK's networking behavior.

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(HttpConfigurationFactory):


     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().

Since:
4.13.0
  • Field Details

  • Constructor Details

  • Method Details

    • connectTimeout

      public HttpConfigurationBuilder connectTimeout​(java.time.Duration connectTimeout)
      Sets the connection timeout. This is the time allowed for the SDK to make a socket connection to any of the LaunchDarkly services.

      The default is DEFAULT_CONNECT_TIMEOUT.

      Parameters:
      connectTimeout - the connection timeout; null to use the default
      Returns:
      the builder
    • proxyHostAndPort

      public HttpConfigurationBuilder proxyHostAndPort​(java.lang.String host, int port)
      Sets an HTTP proxy for making connections to LaunchDarkly.
      Parameters:
      host - the proxy hostname
      port - the proxy port
      Returns:
      the builder
    • proxyAuth

      public HttpConfigurationBuilder proxyAuth​(HttpAuthentication strategy)
      Sets an authentication strategy for use with an HTTP proxy. This has no effect unless a proxy was specified with proxyHostAndPort(String, int).
      Parameters:
      strategy - the authentication strategy
      Returns:
      the builder
    • socketTimeout

      public HttpConfigurationBuilder socketTimeout​(java.time.Duration socketTimeout)
      Sets 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 by 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.

      Parameters:
      socketTimeout - the socket timeout; null to use the default
      Returns:
      the builder
    • socketFactory

      public HttpConfigurationBuilder socketFactory​(javax.net.SocketFactory socketFactory)
      Specifies a custom socket configuration for HTTP connections to LaunchDarkly.

      This uses the standard Java interfaces for configuring socket connections.

      Parameters:
      socketFactory - the socket factory
      Returns:
      the builder
    • sslSocketFactory

      public HttpConfigurationBuilder sslSocketFactory​(javax.net.ssl.SSLSocketFactory sslSocketFactory, javax.net.ssl.X509TrustManager trustManager)
      Specifies a custom security configuration for HTTPS connections to LaunchDarkly.

      This uses the standard Java interfaces for configuring secure socket connections and certificate verification.

      Parameters:
      sslSocketFactory - the SSL socket factory
      trustManager - the trust manager
      Returns:
      the builder
    • wrapper

      public 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. This will be included in a header during requests to the LaunchDarkly servers to allow recording metrics on the usage of these wrapper libraries.
      Parameters:
      wrapperName - an identifying name for the wrapper library
      wrapperVersion - version string for the wrapper library
      Returns:
      the builder