Class HttpConfigurationBuilder

    • Field Detail

      • DEFAULT_CONNECT_TIMEOUT

        public static final java.time.Duration DEFAULT_CONNECT_TIMEOUT
        The default value for connectTimeout(Duration): two seconds.
      • DEFAULT_SOCKET_TIMEOUT

        public static final java.time.Duration DEFAULT_SOCKET_TIMEOUT
        The default value for socketTimeout(Duration): 10 seconds.
      • connectTimeout

        protected java.time.Duration connectTimeout
      • proxyHost

        protected java.lang.String proxyHost
      • customHeaders

        protected java.util.Map<java.lang.String,​java.lang.String> customHeaders
      • proxyPort

        protected int proxyPort
      • socketTimeout

        protected java.time.Duration socketTimeout
      • socketFactory

        protected javax.net.SocketFactory socketFactory
      • sslSocketFactory

        protected javax.net.ssl.SSLSocketFactory sslSocketFactory
      • trustManager

        protected javax.net.ssl.X509TrustManager trustManager
      • wrapperName

        protected java.lang.String wrapperName
      • wrapperVersion

        protected java.lang.String wrapperVersion
    • Constructor Detail

      • HttpConfigurationBuilder

        public HttpConfigurationBuilder()
    • Method Detail

      • 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
      • 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
      • addCustomHeader

        public HttpConfigurationBuilder addCustomHeader​(java.lang.String headerName,
                                                        java.lang.String headerValue)
        Specifies a custom HTTP header that should be added to all SDK requests.

        This may be helpful if you are using a gateway or proxy server that requires a specific header in requests. You may add any number of headers.

        Parameters:
        headerName - standard HTTP header
        headerValue - standard HTTP value
        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