Class 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:
    3.3.0
    • Constructor Summary

      Constructors 
      Constructor Description
      HttpConfiguration​(int connectTimeoutMillis, java.util.Map<java.lang.String,​java.lang.String> defaultHeaders, LDHeaderUpdater headerTransform, boolean useReport)
      Creates an instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getConnectTimeoutMillis()
      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.
      LDHeaderUpdater getHeaderTransform()
      Returns the callback for modifying request headers, if any.
      boolean isUseReport()
      The setting for whether to use the HTTP REPORT method.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getConnectTimeoutMillis

        public int getConnectTimeoutMillis()
        The connection timeout. This is the time allowed for the underlying HTTP client to connect to the LaunchDarkly server.
        Returns:
        the connection timeout in milliseconds
      • 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
      • getHeaderTransform

        public LDHeaderUpdater getHeaderTransform()
        Returns the callback for modifying request headers, if any.
        Returns:
        the callback for modifying request headers
      • isUseReport

        public boolean isUseReport()
        The setting for whether to use the HTTP REPORT method.
        Returns:
        true to use HTTP REPORT