org.keycloak.services.util

## Class HttpClientBuilder

- java.lang.Object
- - org.keycloak.services.util.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 and Description
    --- | ---
    `static class` | `HttpClientBuilder.HostnameVerificationPolicy`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected KeyStore` | `clientKeyStore`
    `protected String` | `clientPrivateKeyPassword`
    `protected int` | `connectionPoolSize`
    `protected long` | `connectionTTL`
    `protected TimeUnit` | `connectionTTLUnit`
    `protected boolean` | `disableTrustManager`
    `protected long` | `establishConnectionTimeout`
    `protected TimeUnit` | `establishConnectionTimeoutUnits`
    `protected int` | `maxPooledPerRoute`
    `protected HttpClientBuilder.HostnameVerificationPolicy` | `policy`
    `protected long` | `socketTimeout`
    `protected TimeUnit` | `socketTimeoutUnits`
    `protected SSLContext` | `sslContext`
    `protected KeyStore` | `truststore`
    `protected HostnameVerifier` | `verifier`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HttpClientBuilder()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `org.apache.http.client.HttpClient` | `build()`
    `org.apache.http.client.HttpClient` | `build(AdapterConfig adapterConfig)`
    `HttpClientBuilder` | `connectionPoolSize(int connectionPoolSize)`
    `HttpClientBuilder` | `connectionTTL(long ttl, TimeUnit unit)`
    `HttpClientBuilder` | `disableTrustManager()` Disable trust management and hostname verification.
    `HttpClientBuilder` | `establishConnectionTimeout(long timeout, TimeUnit unit)` When trying to make an initial socket connection, what is the timeout?
    `HttpClientBuilder` | `hostnameVerification(HttpClientBuilder.HostnameVerificationPolicy policy)` SSL policy used to verify hostnames
    `HttpClientBuilder` | `keyStore(KeyStore keyStore, char[] password)`
    `HttpClientBuilder` | `keyStore(KeyStore keyStore, String password)`
    `HttpClientBuilder` | `maxPooledPerRoute(int maxPooledPerRoute)`
    `HttpClientBuilder` | `socketTimeout(long timeout, TimeUnit unit)` Socket inactivity timeout
    `HttpClientBuilder` | `sslContext(SSLContext sslContext)`
    `HttpClientBuilder` | `trustStore(KeyStore truststore)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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

    - #### connectionTTLUnit

          protected TimeUnit connectionTTLUnit

    - #### verifier

          protected HostnameVerifier verifier

    - #### socketTimeout

          protected long socketTimeout

    - #### socketTimeoutUnits

          protected TimeUnit socketTimeoutUnits

    - #### establishConnectionTimeout

          protected long establishConnectionTimeout

    - #### establishConnectionTimeoutUnits

          protected TimeUnit establishConnectionTimeoutUnits

  - ### Constructor Detail

    - #### HttpClientBuilder

          public HttpClientBuilder()

  - ### 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)

    - #### 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.

    - #### 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)

    - #### build

          public org.apache.http.client.HttpClient build()

    - #### build

          public org.apache.http.client.HttpClient build(AdapterConfig adapterConfig)

Copyright © 2014. All Rights Reserved.