Class HttpConfigurationBuilder
- All Implemented Interfaces:
ComponentConfigurer<HttpConfiguration>
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 Summary
Modifier and TypeFieldDescriptionprotected int
Connection timeout in millisstatic final int
The default value forconnectTimeoutMillis(int)
: ten seconds.protected LDHeaderUpdater
LDHeaderUpdater
that will be applied to requestsprotected boolean
Whether or not Http REPORT method will be usedprotected String
Name of the wrapping libraryprotected String
Version of the wrapping library -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionconnectTimeoutMillis
(int connectTimeoutMillis) Sets the connection timeout.headerTransform
(LDHeaderUpdater headerTransform) Provides a callback for dynamically modifying headers used on requests to LaunchDarkly services.useReport
(boolean useReport) Sets whether to use the HTTP REPORT method for feature flag requests.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 Details
-
DEFAULT_CONNECT_TIMEOUT_MILLIS
public static final int DEFAULT_CONNECT_TIMEOUT_MILLISThe default value forconnectTimeoutMillis(int)
: ten seconds.- See Also:
-
connectTimeoutMillis
protected int connectTimeoutMillisConnection timeout in millis -
headerTransform
LDHeaderUpdater
that will be applied to requests -
useReport
protected boolean useReportWhether or not Http REPORT method will be used -
wrapperName
Name of the wrapping library -
wrapperVersion
Version of the wrapping library
-
-
Constructor Details
-
HttpConfigurationBuilder
public HttpConfigurationBuilder()
-
-
Method Details
-
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
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
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
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
-