Class HttpClientBuilder
- java.lang.Object
-
- org.keycloak.connections.httpclient.HttpClientBuilder
-
public class HttpClientBuilder extends Object
Abstraction for creating HttpClients. Allows SSL configuration.- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
HttpClientBuilder.HostnameVerificationPolicy
-
Field Summary
Fields Modifier and Type Field Description protected KeyStore
clientKeyStore
protected String
clientPrivateKeyPassword
protected int
connectionPoolSize
protected long
connectionTTL
protected TimeUnit
connectionTTLUnit
protected boolean
disableCookies
protected boolean
disableTrustManager
protected long
establishConnectionTimeout
protected TimeUnit
establishConnectionTimeoutUnits
protected boolean
expectContinueEnabled
protected long
maxConnectionIdleTime
protected TimeUnit
maxConnectionIdleTimeUnit
protected int
maxPooledPerRoute
protected HttpClientBuilder.HostnameVerificationPolicy
policy
protected ProxyMappings
proxyMappings
protected boolean
reuseConnections
protected long
socketTimeout
protected TimeUnit
socketTimeoutUnits
protected SSLContext
sslContext
protected KeyStore
truststore
protected HostnameVerifier
verifier
-
Constructor Summary
Constructors Constructor Description HttpClientBuilder()
-
Method Summary
-
-
-
Field Detail
-
truststore
protected KeyStore truststore
-
clientKeyStore
protected KeyStore clientKeyStore
-
clientPrivateKeyPassword
protected String clientPrivateKeyPassword
-
disableTrustManager
protected boolean disableTrustManager
-
policy
protected HttpClientBuilder.HostnameVerificationPolicy policy
-
sslContext
protected SSLContext sslContext
-
connectionPoolSize
protected int connectionPoolSize
-
maxPooledPerRoute
protected int maxPooledPerRoute
-
connectionTTL
protected long connectionTTL
-
reuseConnections
protected boolean reuseConnections
-
connectionTTLUnit
protected TimeUnit connectionTTLUnit
-
maxConnectionIdleTime
protected long maxConnectionIdleTime
-
maxConnectionIdleTimeUnit
protected TimeUnit maxConnectionIdleTimeUnit
-
verifier
protected HostnameVerifier verifier
-
socketTimeout
protected long socketTimeout
-
socketTimeoutUnits
protected TimeUnit socketTimeoutUnits
-
establishConnectionTimeout
protected long establishConnectionTimeout
-
establishConnectionTimeoutUnits
protected TimeUnit establishConnectionTimeoutUnits
-
disableCookies
protected boolean disableCookies
-
proxyMappings
protected ProxyMappings proxyMappings
-
expectContinueEnabled
protected boolean expectContinueEnabled
-
-
Method Detail
-
socketTimeout
public HttpClientBuilder socketTimeout(long timeout, TimeUnit unit)
Socket inactivity timeout- Parameters:
timeout
-unit
-- Returns:
-
establishConnectionTimeout
public HttpClientBuilder establishConnectionTimeout(long timeout, TimeUnit unit)
When trying to make an initial socket connection, what is the timeout?- Parameters:
timeout
-unit
-- Returns:
-
connectionTTL
public HttpClientBuilder connectionTTL(long ttl, TimeUnit unit)
-
reuseConnections
public HttpClientBuilder reuseConnections(boolean reuseConnections)
-
maxConnectionIdleTime
public HttpClientBuilder maxConnectionIdleTime(long maxConnectionIdleTime, TimeUnit unit)
-
maxPooledPerRoute
public HttpClientBuilder maxPooledPerRoute(int maxPooledPerRoute)
-
connectionPoolSize
public HttpClientBuilder connectionPoolSize(int connectionPoolSize)
-
disableTrustManager
public HttpClientBuilder disableTrustManager()
Disable trust management and hostname verification. NOTE this is a security hole, so only set this option if you cannot or do not want to verify the identity of the host you are communicating with.
-
disableCookies
public HttpClientBuilder disableCookies(boolean disable)
Disable cookie management.
-
hostnameVerification
public HttpClientBuilder hostnameVerification(HttpClientBuilder.HostnameVerificationPolicy policy)
SSL policy used to verify hostnames- Parameters:
policy
-- Returns:
-
sslContext
public HttpClientBuilder sslContext(SSLContext sslContext)
-
trustStore
public HttpClientBuilder trustStore(KeyStore truststore)
-
keyStore
public HttpClientBuilder keyStore(KeyStore keyStore, String password)
-
keyStore
public HttpClientBuilder keyStore(KeyStore keyStore, char[] password)
-
proxyMappings
public HttpClientBuilder proxyMappings(ProxyMappings proxyMappings)
-
expectContinueEnabled
public HttpClientBuilder expectContinueEnabled(boolean expectContinueEnabled)
-
build
public org.apache.http.impl.client.CloseableHttpClient build()
-
-