Class HttpConfigurationBuilder

java.lang.Object
com.launchdarkly.sdk.android.integrations.HttpConfigurationBuilder
All Implemented Interfaces:
ComponentConfigurer<HttpConfiguration>

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()
         .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:
3.3.0
  • Field Details

    • DEFAULT_CONNECT_TIMEOUT_MILLIS

      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.

      The default is DEFAULT_CONNECT_TIMEOUT_MILLIS.

      Parameters:
      connectTimeoutMillis - the connection timeout in milliseconds
      Returns:
      the builder
    • headerTransform

      public HttpConfigurationBuilder headerTransform(LDHeaderUpdater headerTransform)
      Provides a callback for dynamically modifying headers used on requests to LaunchDarkly services.
      Parameters:
      headerTransform - the transformation to apply to requests
      Returns:
      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.

      Parameters:
      useReport - true to enable the REPORT method
      Returns:
      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.
      Parameters:
      wrapperName - an identifying name for the wrapper library
      wrapperVersion - version string for the wrapper library
      Returns:
      the builder