Package com.licensespring.api
Class ApiBuilderHelper
- java.lang.Object
-
- com.licensespring.api.ApiBuilderHelper
-
public final class ApiBuilderHelper extends Object
Utility class for adding proxy and ssl configurations to Apis
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addConnectionSpecs(okhttp3.OkHttpClient.Builder builder, List<okhttp3.ConnectionSpec> connectionSpecs)
Specifies configuration for the socket connection that HTTP traffic travels through.static void
addProxySettings(String proxyHost, Integer proxyPort, String proxyUser, String proxyPass, okhttp3.OkHttpClient.Builder builder)
Check the Proxy settings (host,port, username and password) and adds the ProxyConfiguration to theOkHttpClient.Builder
if at least a Proxy Port is foundstatic feign.Retryer
createRetryer(boolean isEnableRetrying)
Creates aRetryer
depending on the configuration paramstatic void
disableSsl(okhttp3.OkHttpClient.Builder builder)
Disables SSL checking when contacting LS servers Used for corner cases where the root cert is missingstatic void
setHostnameVerifier(okhttp3.OkHttpClient.Builder builder, HostnameVerifier hostnameVerifier)
Sets the verifier used to confirm that response certificates apply to requested hostnames for HTTPS connections.static void
setTimeout(Long requestTimeout, okhttp3.OkHttpClient.Builder builder)
Adds the timeout for read/write/connect for OkHttpClientBuilder
-
-
-
Method Detail
-
createRetryer
public static feign.Retryer createRetryer(boolean isEnableRetrying)
Creates aRetryer
depending on the configuration param- Parameters:
isEnableRetrying
- configuration field if retrying is enabled- Returns:
- Retryer - the default one or with retrying disabled
-
setTimeout
public static void setTimeout(Long requestTimeout, okhttp3.OkHttpClient.Builder builder)
Adds the timeout for read/write/connect for OkHttpClientBuilder- Parameters:
requestTimeout
- duration for the request timeout, in secondsbuilder
- httpClient builder for adding proxy settings
-
addProxySettings
public static void addProxySettings(String proxyHost, Integer proxyPort, String proxyUser, String proxyPass, okhttp3.OkHttpClient.Builder builder)
Check the Proxy settings (host,port, username and password) and adds the ProxyConfiguration to theOkHttpClient.Builder
if at least a Proxy Port is found- Parameters:
proxyHost
- host for proxy configurationproxyPort
- port for proxy configurationproxyUser
- username for proxy configurationproxyPass
- password for proxy configurationbuilder
- httpClient builder for adding proxy settings
-
disableSsl
public static void disableSsl(okhttp3.OkHttpClient.Builder builder)
Disables SSL checking when contacting LS servers Used for corner cases where the root cert is missing- Parameters:
builder
- httpClient builder for disabling ssl checks
-
addConnectionSpecs
public static void addConnectionSpecs(okhttp3.OkHttpClient.Builder builder, List<okhttp3.ConnectionSpec> connectionSpecs)
Specifies configuration for the socket connection that HTTP traffic travels through.- Parameters:
builder
- httpClient builderconnectionSpecs
- connection specs
-
setHostnameVerifier
public static void setHostnameVerifier(okhttp3.OkHttpClient.Builder builder, HostnameVerifier hostnameVerifier)
Sets the verifier used to confirm that response certificates apply to requested hostnames for HTTPS connections. If unset, a default hostname verifier will be used.- Parameters:
builder
- httpClient builderhostnameVerifier
- verifier
-
-