Class HttpConfigurationBuilder

All Implemented Interfaces:

public abstract class HttpConfigurationBuilder extends Object implements ComponentConfigurer<HttpConfiguration>
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(ComponentConfigurer):

     LDConfig config = new LDConfig.Builder()
             .proxyHostAndPort("my-proxy", 8080)

Note that this class is abstract; the actual implementation is created by calling Components.httpConfiguration().

  • Field Details


      public static final int DEFAULT_CONNECT_TIMEOUT_MILLIS
      The default value for connectTimeoutMillis(int): ten seconds.
      See Also:
    • connectTimeoutMillis

      protected int connectTimeoutMillis
      Connection timeout in millis
    • headerTransform

      protected LDHeaderUpdater headerTransform
      LDHeaderUpdater that will be applied to requests
    • useReport

      protected boolean useReport
      Whether or not Http REPORT method will be used
    • wrapperName

      protected String wrapperName
      Name of the wrapping library
    • wrapperVersion

      protected String wrapperVersion
      Version of the wrapping library
  • Constructor Details

    • HttpConfigurationBuilder

      public HttpConfigurationBuilder()
  • Method Details

    • connectTimeoutMillis

      public HttpConfigurationBuilder connectTimeoutMillis(int connectTimeoutMillis)
      Sets the connection timeout. This is the time allowed for the SDK to make a socket connection to any of the LaunchDarkly services.


      connectTimeoutMillis - the connection timeout in milliseconds
      the builder
    • headerTransform

      public HttpConfigurationBuilder headerTransform(LDHeaderUpdater headerTransform)
      Provides a callback for dynamically modifying headers used on requests to LaunchDarkly services.
      headerTransform - the transformation to apply to requests
      the builder
    • useReport

      public HttpConfigurationBuilder useReport(boolean useReport)
      Sets whether to use the HTTP REPORT method for feature flag requests.

      By default, polling and streaming connections are made with the GET method, with the context data encoded into the request URI. Using REPORT allows the context data to be sent in the request body instead, which is somewhat more secure and efficient.

      However, the REPORT method is not always supported by operating systems or network gateways. Therefore it is disabled in the SDK by default. You can enable it if you know your code will not be running in an environment that disallows REPORT.

      useReport - true to enable the REPORT method
      the builder
    • wrapper

      public HttpConfigurationBuilder wrapper(String wrapperName, 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.
      wrapperName - an identifying name for the wrapper library
      wrapperVersion - version string for the wrapper library
      the builder