Package com.exasol.bucketfs.http
Class HttpClientBuilder
- java.lang.Object
-
- com.exasol.bucketfs.http.HttpClientBuilder
-
public class HttpClientBuilder extends Object
A builder forHttpClientthat provides a convenient way for ignoring TLS errors.
-
-
Constructor Summary
Constructors Constructor Description HttpClientBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpClientBuilderallowAlternativeHostName(String hostName)Update the certificate specified viacertificate(X509Certificate)to allow an additional host name, e.g.HttpClientBuilderallowAlternativeIPAddress(String ipAddress)Update the certificate specified viacertificate(X509Certificate)to allow an additional IP address, e.g.HttpClientbuild()Creates a newHttpClientusing the specified configuration.HttpClientBuildercertificate(X509Certificate certificate)Use the given certificate for TLS connections.HttpClientBuilderraiseTlsErrors(boolean raiseTlsErrors)Define if TLS errors should raise an error when executing requests or if they should be ignored.
-
-
-
Method Detail
-
raiseTlsErrors
public HttpClientBuilder raiseTlsErrors(boolean raiseTlsErrors)
Define if TLS errors should raise an error when executing requests or if they should be ignored. Setting this tofalseis required as the docker-db uses a self-signed certificate.Defaults to raise TLS errors.
Setting this to
falseis mutually exclusive withcertificate.- Parameters:
raiseTlsErrors-trueif theCommandFactoryshould fail for TLS errors,falseif it should ignore TLS errors.- Returns:
- this instance for method chaining
-
certificate
public HttpClientBuilder certificate(X509Certificate certificate)
Use the given certificate for TLS connections.Defaults to using the certificates from the JVMs default key store.
Mutually exclusive with setting
raiseTlsErrorstofalse.- Parameters:
certificate- certificate to use- Returns:
- this instance for method chaining
-
allowAlternativeHostName
public HttpClientBuilder allowAlternativeHostName(String hostName)
Update the certificate specified viacertificate(X509Certificate)to allow an additional host name, e.g.localhost.This is useful when a self-signed certificate does not contain the required subject alternative name (SAN).
- Parameters:
hostName- additional hostname to allow- Returns:
- this instance for method chaining
-
allowAlternativeIPAddress
public HttpClientBuilder allowAlternativeIPAddress(String ipAddress)
Update the certificate specified viacertificate(X509Certificate)to allow an additional IP address, e.g.127.0.0.1.This is useful when a self-signed certificate does not contain the required subject alternative name (SAN).
- Parameters:
ipAddress- additional IP address to allow- Returns:
- this instance for method chaining
-
build
public HttpClient build()
Creates a newHttpClientusing the specified configuration.- Returns:
- a new
HttpClient
-
-