Package com.flagsmith.config
Class FlagsmithConfig.Builder
java.lang.Object
com.flagsmith.config.FlagsmithConfig.Builder
- Enclosing class:
FlagsmithConfig
-
Method Summary
Modifier and TypeMethodDescriptionaddHttpInterceptor(okhttp3.Interceptor interceptor) Add a custom HTTP interceptor.Set the base URL for Flagsmith API, overriding default one.build()connectionPool(okhttp3.ConnectionPool connectionPool) Provide a custom OkHttp ConnectionPool to tune keep-alive duration and maximum idle connections.connectTimeout(int connectTimeoutMillis) Override default connection timeout for client connection.readTimeout(int readTimeoutMillis) Override default read timeout for client connection.Add retries for HTTP request to the builder.sslSocketFactory(SSLSocketFactory sslSocketFactory, X509TrustManager trustManager) Added custom SSL certificate.withAnalyticsProcessor(AnalyticsProcessor processor) Set the analytics processor.withEnableAnalytics(Boolean enable) Enable Analytics Processor.set environment refresh rate with polling manager.withLocalEvaluation(Boolean localEvaluation) Local evaluation config.withOfflineHandler(IOfflineHandler offlineHandler) Set the offline handler (used as a fallback or with offlineMode).withOfflineMode(Boolean offlineMode) Enable offline mode.Add a Proxy to the HttpClient.withSupportedProtocols(List<FlagsmithConfig.Protocol> supportedProtocols) Specify the list of protocols supported for calls to the server.writeTimeout(int writeTimeoutMillis) Override default write timeout for client connection.
-
Method Details
-
baseUri
Set the base URL for Flagsmith API, overriding default one.- Parameters:
baseUri- the new base URI for the API.- Returns:
- the Builder
-
connectTimeout
Override default connection timeout for client connection.- Parameters:
connectTimeoutMillis- the connect timeout in milliseconds- Returns:
- the Builder
-
writeTimeout
Override default write timeout for client connection.- Parameters:
writeTimeoutMillis- the write timeout in milliseconds- Returns:
- the Builder
-
readTimeout
Override default read timeout for client connection.- Parameters:
readTimeoutMillis- the read timeout in milliseconds- Returns:
- the Builder
-
sslSocketFactory
public FlagsmithConfig.Builder sslSocketFactory(SSLSocketFactory sslSocketFactory, X509TrustManager trustManager) Added custom SSL certificate.- Parameters:
sslSocketFactory- SSL factorytrustManager- X509TrustManager trust manager- Returns:
- the Builder
-
addHttpInterceptor
Add a custom HTTP interceptor.- Parameters:
interceptor- the HTTP interceptor- Returns:
- the Builder
-
withProxy
Add a Proxy to the HttpClient.- Parameters:
proxy- the proxy- Returns:
- the Builder
-
connectionPool
Provide a custom OkHttp ConnectionPool to tune keep-alive duration and maximum idle connections. When not set, OkHttp's defaults are used.- Parameters:
connectionPool- the ConnectionPool to use for the HTTP client- Returns:
- the Builder
-
retries
Add retries for HTTP request to the builder.- Parameters:
retries- no of retries for requests
-
withLocalEvaluation
Local evaluation config.- Parameters:
localEvaluation- boolean to enable
-
withEnvironmentRefreshIntervalSeconds
set environment refresh rate with polling manager. Only needed when local evaluation is true.- Parameters:
seconds- seconds
-
withAnalyticsProcessor
Set the analytics processor.- Parameters:
processor- analytics processor object
-
withEnableAnalytics
Enable Analytics Processor.- Parameters:
enable- boolean to enable
-
withOfflineMode
Enable offline mode.- Parameters:
offlineMode- boolean to enable offline mode
-
withOfflineHandler
Set the offline handler (used as a fallback or with offlineMode).- Parameters:
offlineHandler- the offline handler
-
withSupportedProtocols
public FlagsmithConfig.Builder withSupportedProtocols(List<FlagsmithConfig.Protocol> supportedProtocols) Specify the list of protocols supported for calls to the server.- Parameters:
supportedProtocols- the list of supported protocols
-
build
-