Package com.wultra.core.rest.client.base
Class RestClientConfiguration
java.lang.Object
com.wultra.core.rest.client.base.RestClientConfiguration
REST client configuration.
This class is safe to use as
org.springframework.boot.context.properties.ConfigurationProperties.- Author:
- Roman Strobl, roman.strobl@wultra.com
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.MediaTypeGet accept type.Get base URL.Get connection timeout in milliseconds.org.springframework.http.MediaTypeGet content type.org.springframework.http.HttpHeadersGet the default HTTP headers.org.springframework.web.reactive.function.client.ExchangeFilterFunctionGet the exchange filter function.Get the SSL handshake timeout.Get password for basic HTTP authentication.Get username for basic HTTP authentication.Get password for digest HTTP authentication.Get username for digest HTTP authentication.Get the jackson configuration.Get Keep-Alive retransmission limit.Get Keep-Alive idle time.Get Keep-Alive retransmission interval time.Get private key alias for client TLS certificate authentication.Get private key password for client TLS certificate authentication.byte[]Get byte data with the key store.Get keystore resource location for client TLS certificate authentication.Get keystore password for client TLS certificate authentication.Get max idle time.Get maximum in memory request size.Get max life time.Get proxy host.Get proxy password.intGet proxy port.Get proxy username.Get the maximum duration allowed between each network-level read operations (resolution: ms).byte[]Get byte data with the trust store.Get truststore resource location for client TLS certificate authentication.Get truststore password for client TLS certificate authentication.booleanGet whether invalid SSL certificate is accepted.booleanGet whether client TLS certificate authentication is enabled.booleanGet whether following of redirections is enabled.booleanGet whether basic HTTP authentication is enabled.booleanGet whether digest HTTP authentication is enabled.booleanReturn whether Keep-Alive is enabled.booleanGet whether error HTTP responses are logged as warnings.booleanGet whether proxy is enabled.booleanGet whether simple one-line logging of HTTP requests and responses is enabled.voidsetAcceptInvalidSslCertificate(boolean acceptInvalidSslCertificate) Set whether invalid SSL certificate is accepted.voidsetAcceptType(org.springframework.http.MediaType acceptType) Set accept type.voidsetBaseUrl(String baseUrl) Set base URL.voidsetCertificateAuthEnabled(boolean certificateAuthEnabled) Set whether client TLS certificate authentication is enabled.voidsetConnectionTimeout(Duration connectionTimeout) Set connection timeout.voidsetContentType(org.springframework.http.MediaType contentType) Set content type.voidsetDefaultHttpHeaders(org.springframework.http.HttpHeaders headers) Set the default HTTP headers.voidsetFilter(org.springframework.web.reactive.function.client.ExchangeFilterFunction filter) Set the exchange filter function.voidsetFollowRedirectEnabled(boolean followRedirectEnabled) Sets whether following of redirections is enabledvoidsetHandshakeTimeout(Duration handshakeTimeout) Set the SSL handshake timeout.voidsetHttpBasicAuthEnabled(boolean httpBasicAuthEnabled) Set whether basic HTTP authentication is enabled.voidsetHttpBasicAuthPassword(String httpBasicAuthPassword) Set password for basic HTTP authentication.voidsetHttpBasicAuthUsername(String httpBasicAuthUsername) Set username for basic HTTP authentication.voidsetHttpDigestAuthEnabled(boolean httpDigestAuthEnabled) Set whether digest HTTP authentication is enabled.voidsetHttpDigestAuthPassword(String httpDigestAuthPassword) Set password for digest HTTP authentication.voidsetHttpDigestAuthUsername(String httpDigestAuthUsername) Set username for digest HTTP authentication.voidsetJacksonConfiguration(RestClientConfiguration.JacksonConfiguration jacksonConfiguration) Set the jackson configuration.voidsetKeepAliveCount(Integer keepAliveCount) Set Keep-Alive retransmission limit.voidsetKeepAliveEnabled(boolean keepAliveEnabled) Set whether Keep-Alive is enabledvoidsetKeepAliveIdle(Duration keepAliveIdle) Set Keep-Alive idle time.voidsetKeepAliveInterval(Duration keepAliveInterval) Set Keep-Alive retransmission interval time.voidsetKeyAlias(String keyAlias) Set private key alias for client TLS certificate authentication.voidsetKeyPassword(String keyPassword) Set private key password for client TLS certificate authentication.voidsetKeyStoreBytes(byte[] keyStoreBytes) Set byte data with the key store.voidsetKeyStoreLocation(String keyStoreLocation) Set keystore resource location for client TLS certificate authentication.voidsetKeyStorePassword(String keyStorePassword) Set keystore password for client TLS certificate authentication.voidsetLogErrorResponsesAsWarnings(boolean logErrorResponsesAsWarnings) Set whether error HTTP responses are logged as warnings.voidsetMaxIdleTime(Duration maxIdleTime) Set the options to use for configuring ConnectionProvider max idle time.voidsetMaxInMemorySize(Integer maxInMemorySize) Set maximum in memory request size.voidsetMaxLifeTime(Duration maxLifeTime) Set the options to use for configuring ConnectionProvider max life time.voidsetProxyEnabled(boolean proxyEnabled) Set whether proxy is enabled.voidsetProxyHost(String proxyHost) Set proxy host.voidsetProxyPassword(String proxyPassword) Set proxy password.voidsetProxyPort(int proxyPort) Set proxy port.voidsetProxyUsername(String proxyUsername) Set proxy username.voidsetResponseTimeout(Duration responseTimeout) Set the maximum duration allowed between each network-level read operations (resolution: ms).voidsetSimpleLoggingEnabled(boolean simpleLoggingEnabled) Set whether simple one-line logging of HTTP requests and responses is enabled.voidsetTrustStoreBytes(byte[] trustStoreBytes) Set byte data with the trust store.voidsetTrustStoreLocation(String trustStoreLocation) Set truststore resource location for client TLS certificate authentication.voidsetTrustStorePassword(String trustStorePassword) Set truststore password for client TLS certificate authentication.voidsetUseCustomKeyStore(boolean useCustomKeyStore) Set whether custom keystore is used for client TLS certificate authentication.voidsetUseCustomTrustStore(boolean useCustomTrustStore) Set whether custom truststore is used for client TLS certificate authentication.booleanGet whether custom keystore is used for client TLS certificate authentication.booleanGet whether custom truststore is used for client TLS certificate authentication.
-
Constructor Details
-
RestClientConfiguration
public RestClientConfiguration()
-
-
Method Details
-
getBaseUrl
Get base URL.- Returns:
- Base URL.
-
setBaseUrl
Set base URL.- Parameters:
baseUrl- Base URL.
-
getContentType
public org.springframework.http.MediaType getContentType()Get content type.- Returns:
- Content type.
-
setContentType
public void setContentType(org.springframework.http.MediaType contentType) Set content type.- Parameters:
contentType- Content type.
-
getAcceptType
public org.springframework.http.MediaType getAcceptType()Get accept type.- Returns:
- Accept type.
-
setAcceptType
public void setAcceptType(org.springframework.http.MediaType acceptType) Set accept type.- Parameters:
acceptType- Accepty type.
-
isProxyEnabled
public boolean isProxyEnabled()Get whether proxy is enabled.- Returns:
- Whether proxy is enabled.
-
setProxyEnabled
public void setProxyEnabled(boolean proxyEnabled) Set whether proxy is enabled.- Parameters:
proxyEnabled- Whether proxy is enabled.
-
getProxyHost
Get proxy host.- Returns:
- Proxy host.
-
setProxyHost
Set proxy host.- Parameters:
proxyHost- Proxy host.
-
getProxyPort
public int getProxyPort()Get proxy port.- Returns:
- Proxy port.
-
setProxyPort
public void setProxyPort(int proxyPort) Set proxy port.- Parameters:
proxyPort- Proxy port.
-
getProxyUsername
Get proxy username.- Returns:
- Proxy username.
-
setProxyUsername
Set proxy username.- Parameters:
proxyUsername- Proxy username.
-
getProxyPassword
Get proxy password.- Returns:
- Proxy password.
-
setProxyPassword
Set proxy password.- Parameters:
proxyPassword- Proxy password.
-
getConnectionTimeout
Get connection timeout in milliseconds.- Returns:
- Connection timeout.
-
setConnectionTimeout
Set connection timeout.- Parameters:
connectionTimeout- Connection timeout as a Duration object.
-
getMaxIdleTime
Get max idle time.- Returns:
- Max idle time.
-
setMaxIdleTime
Set the options to use for configuring ConnectionProvider max idle time.Nullmeans no max idle time.- Parameters:
maxIdleTime- Max idle time.
-
getMaxLifeTime
Get max life time.- Returns:
- Max life time.
-
setMaxLifeTime
Set the options to use for configuring ConnectionProvider max life time.Nullmeans no max life time.- Parameters:
maxLifeTime- Max life time.
-
isKeepAliveEnabled
public boolean isKeepAliveEnabled()Return whether Keep-Alive is enabled.- Returns:
Trueif keep-alive enabled-
-
setKeepAliveEnabled
public void setKeepAliveEnabled(boolean keepAliveEnabled) Set whether Keep-Alive is enabled- Parameters:
keepAliveEnabled- Keep-Alive.
-
getKeepAliveIdle
Get Keep-Alive idle time.- Returns:
- Keep-Alive idle time.
-
setKeepAliveIdle
Set Keep-Alive idle time.- Parameters:
keepAliveIdle- Keep-Alive idle time.
-
getKeepAliveInterval
Get Keep-Alive retransmission interval time.- Returns:
- Keep-Alive retransmission interval time.
-
setKeepAliveInterval
Set Keep-Alive retransmission interval time.- Parameters:
keepAliveInterval- Keep-Alive retransmission interval time.
-
getKeepAliveCount
Get Keep-Alive retransmission limit.- Returns:
- Keep-Alive retransmission limit.
-
setKeepAliveCount
Set Keep-Alive retransmission limit.- Parameters:
keepAliveCount- Keep-Alive retransmission limit.
-
isAcceptInvalidSslCertificate
public boolean isAcceptInvalidSslCertificate()Get whether invalid SSL certificate is accepted.- Returns:
- Whether invalid SSL certificate is accepted.
-
setAcceptInvalidSslCertificate
public void setAcceptInvalidSslCertificate(boolean acceptInvalidSslCertificate) Set whether invalid SSL certificate is accepted.- Parameters:
acceptInvalidSslCertificate- Whether invalid SSL certificate is accepted.
-
getMaxInMemorySize
Get maximum in memory request size.- Returns:
- Maximum in memory request size.
-
setMaxInMemorySize
Set maximum in memory request size.- Parameters:
maxInMemorySize- Maximum in memory request size.
-
isHttpBasicAuthEnabled
public boolean isHttpBasicAuthEnabled()Get whether basic HTTP authentication is enabled.- Returns:
- Whether basic HTTP authentication is enabled.
-
setHttpBasicAuthEnabled
public void setHttpBasicAuthEnabled(boolean httpBasicAuthEnabled) Set whether basic HTTP authentication is enabled.- Parameters:
httpBasicAuthEnabled- Whether basic HTTP authentication is enabled.
-
getHttpBasicAuthUsername
Get username for basic HTTP authentication.- Returns:
- Username for basic HTTP authentication.
-
setHttpBasicAuthUsername
Set username for basic HTTP authentication.- Parameters:
httpBasicAuthUsername- Username for basic HTTP authentication.
-
getHttpBasicAuthPassword
Get password for basic HTTP authentication.- Returns:
- Password for basic HTTP authentication.
-
setHttpBasicAuthPassword
Set password for basic HTTP authentication.- Parameters:
httpBasicAuthPassword- Password for basic HTTP authentication.
-
isHttpDigestAuthEnabled
public boolean isHttpDigestAuthEnabled()Get whether digest HTTP authentication is enabled.- Returns:
- Whether digest HTTP authentication is enabled.
-
setHttpDigestAuthEnabled
public void setHttpDigestAuthEnabled(boolean httpDigestAuthEnabled) Set whether digest HTTP authentication is enabled.- Parameters:
httpDigestAuthEnabled- Whether digest HTTP authentication is enabled.
-
getHttpDigestAuthUsername
Get username for digest HTTP authentication.- Returns:
- Username for digest HTTP authentication.
-
setHttpDigestAuthUsername
Set username for digest HTTP authentication.- Parameters:
httpDigestAuthUsername- Username for digest HTTP authentication.
-
getHttpDigestAuthPassword
Get password for digest HTTP authentication.- Returns:
- Password for digest HTTP authentication.
-
setHttpDigestAuthPassword
Set password for digest HTTP authentication.- Parameters:
httpDigestAuthPassword- Password for digest HTTP authentication.
-
isCertificateAuthEnabled
public boolean isCertificateAuthEnabled()Get whether client TLS certificate authentication is enabled.- Returns:
- Whether client TLS certificate authentication is enabled.
-
setCertificateAuthEnabled
public void setCertificateAuthEnabled(boolean certificateAuthEnabled) Set whether client TLS certificate authentication is enabled.- Parameters:
certificateAuthEnabled- Whether client TLS certificate authentication is enabled.
-
useCustomKeyStore
public boolean useCustomKeyStore()Get whether custom keystore is used for client TLS certificate authentication.- Returns:
- Whether custom keystore is used for client TLS certificate authentication.
-
setUseCustomKeyStore
public void setUseCustomKeyStore(boolean useCustomKeyStore) Set whether custom keystore is used for client TLS certificate authentication.- Parameters:
useCustomKeyStore- Whether custom keystore is used for client TLS certificate authentication.
-
getKeyStoreBytes
@Nullable public byte[] getKeyStoreBytes()Get byte data with the key store.- Returns:
- Byte data with the key store.
-
setKeyStoreBytes
public void setKeyStoreBytes(byte[] keyStoreBytes) Set byte data with the key store.- Parameters:
keyStoreBytes- Byte data with the key store.
-
getKeyStoreLocation
Get keystore resource location for client TLS certificate authentication.- Returns:
- Keystore resource location for client TLS certificate authentication.
-
setKeyStoreLocation
Set keystore resource location for client TLS certificate authentication.- Parameters:
keyStoreLocation- Keystore resource location for client TLS certificate authentication.
-
getKeyStorePassword
Get keystore password for client TLS certificate authentication.- Returns:
- Keystore password for client TLS certificate authentication.
-
setKeyStorePassword
Set keystore password for client TLS certificate authentication.- Parameters:
keyStorePassword- Keystore password for client TLS certificate authentication.
-
getKeyAlias
Get private key alias for client TLS certificate authentication.- Returns:
- Private key alias for client TLS certificate authentication.
-
setKeyAlias
Set private key alias for client TLS certificate authentication.- Parameters:
keyAlias- Private key alias for client TLS certificate authentication.
-
getKeyPassword
Get private key password for client TLS certificate authentication.- Returns:
- Private key password for client TLS certificate authentication.
-
setKeyPassword
Set private key password for client TLS certificate authentication.- Parameters:
keyPassword- Private key password for client TLS certificate authentication.
-
useCustomTrustStore
public boolean useCustomTrustStore()Get whether custom truststore is used for client TLS certificate authentication.- Returns:
- Whether custom truststore is used for client TLS certificate authentication.
-
setUseCustomTrustStore
public void setUseCustomTrustStore(boolean useCustomTrustStore) Set whether custom truststore is used for client TLS certificate authentication.- Parameters:
useCustomTrustStore- Whether custom truststore is used for client TLS certificate authentication.
-
getTrustStoreBytes
@Nullable public byte[] getTrustStoreBytes()Get byte data with the trust store.- Returns:
- Byte data with the trust store
-
setTrustStoreBytes
public void setTrustStoreBytes(byte[] trustStoreBytes) Set byte data with the trust store.- Parameters:
trustStoreBytes- Byte data with the trust store.
-
getTrustStoreLocation
Get truststore resource location for client TLS certificate authentication.- Returns:
- Truststore resource location for client TLS certificate authentication.
-
setTrustStoreLocation
Set truststore resource location for client TLS certificate authentication.- Parameters:
trustStoreLocation- Truststore resource location for client TLS certificate authentication.
-
getTrustStorePassword
Get truststore password for client TLS certificate authentication.- Returns:
- Truststore password for client TLS certificate authentication.
-
setTrustStorePassword
Set truststore password for client TLS certificate authentication.- Parameters:
trustStorePassword- Truststore password for client TLS certificate authentication.
-
getJacksonConfiguration
Get the jackson configuration.- Returns:
- Object mapper.
-
setJacksonConfiguration
public void setJacksonConfiguration(RestClientConfiguration.JacksonConfiguration jacksonConfiguration) Set the jackson configuration.- Parameters:
jacksonConfiguration- jacksonConfiguration.
-
getFilter
public org.springframework.web.reactive.function.client.ExchangeFilterFunction getFilter()Get the exchange filter function.- Returns:
- Exchange filter function.
-
setFilter
public void setFilter(org.springframework.web.reactive.function.client.ExchangeFilterFunction filter) Set the exchange filter function.- Parameters:
filter- Exchange filter function.
-
getDefaultHttpHeaders
public org.springframework.http.HttpHeaders getDefaultHttpHeaders()Get the default HTTP headers.- Returns:
- Default HTTP headers.
-
setDefaultHttpHeaders
public void setDefaultHttpHeaders(org.springframework.http.HttpHeaders headers) Set the default HTTP headers.- Parameters:
headers- Default HTTP headers.
-
getHandshakeTimeout
Get the SSL handshake timeout.- Returns:
- timeout duration
-
setHandshakeTimeout
Set the SSL handshake timeout. Default to 10000 ms.- Parameters:
handshakeTimeout- timeout duration
-
getResponseTimeout
Get the maximum duration allowed between each network-level read operations (resolution: ms).- Returns:
- response timeout
-
setResponseTimeout
Set the maximum duration allowed between each network-level read operations (resolution: ms).- Parameters:
responseTimeout- response timeout (resolution: ms)
-
isFollowRedirectEnabled
public boolean isFollowRedirectEnabled()Get whether following of redirections is enabled.- Returns:
- Whether following of redirections is enabled.
-
setFollowRedirectEnabled
public void setFollowRedirectEnabled(boolean followRedirectEnabled) Sets whether following of redirections is enabled- Parameters:
followRedirectEnabled- Whether following of redirections is enabled
-
isSimpleLoggingEnabled
public boolean isSimpleLoggingEnabled()Get whether simple one-line logging of HTTP requests and responses is enabled.- Returns:
- Whether simple logging is enabled.
-
setSimpleLoggingEnabled
public void setSimpleLoggingEnabled(boolean simpleLoggingEnabled) Set whether simple one-line logging of HTTP requests and responses is enabled.- Parameters:
simpleLoggingEnabled- Whether simple logging is enabled.
-
isLogErrorResponsesAsWarnings
public boolean isLogErrorResponsesAsWarnings()Get whether error HTTP responses are logged as warnings.- Returns:
- Whether error HTTP responses are logged as warnings.
-
setLogErrorResponsesAsWarnings
public void setLogErrorResponsesAsWarnings(boolean logErrorResponsesAsWarnings) Set whether error HTTP responses are logged as warnings.- Parameters:
logErrorResponsesAsWarnings- Whether error HTTP responses are logged as warnings.
-