Class HttpConfigurationBuilder
- java.lang.Object
-
- com.launchdarkly.sdk.android.integrations.HttpConfigurationBuilder
-
- All Implemented Interfaces:
ComponentConfigurer<HttpConfiguration>
public abstract class HttpConfigurationBuilder extends java.lang.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 toLDConfig.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 Summary
Fields Modifier and Type Field Description protected int
connectTimeoutMillis
static int
DEFAULT_CONNECT_TIMEOUT_MILLIS
The default value forconnectTimeoutMillis(int)
: ten seconds.protected LDHeaderUpdater
headerTransform
protected boolean
useReport
protected java.lang.String
wrapperName
protected java.lang.String
wrapperVersion
-
Constructor Summary
Constructors Constructor Description HttpConfigurationBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpConfigurationBuilder
connectTimeoutMillis(int connectTimeoutMillis)
Sets the connection timeout.HttpConfigurationBuilder
headerTransform(LDHeaderUpdater headerTransform)
Provides a callback for dynamically modifying headers used on requests to LaunchDarkly services.HttpConfigurationBuilder
useReport(boolean useReport)
Sets whether to use the HTTP REPORT method for feature flag requests.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.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.launchdarkly.sdk.android.subsystems.ComponentConfigurer
build
-
-
-
-
Field Detail
-
DEFAULT_CONNECT_TIMEOUT_MILLIS
public static final int DEFAULT_CONNECT_TIMEOUT_MILLIS
The default value forconnectTimeoutMillis(int)
: ten seconds.- See Also:
- Constant Field Values
-
connectTimeoutMillis
protected int connectTimeoutMillis
-
headerTransform
protected LDHeaderUpdater headerTransform
-
useReport
protected boolean useReport
-
wrapperName
protected java.lang.String wrapperName
-
wrapperVersion
protected java.lang.String wrapperVersion
-
-
Method Detail
-
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(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 librarywrapperVersion
- version string for the wrapper library- Returns:
- the builder
-
-