Class ScimHttpClient

java.lang.Object
de.captaingoldfish.scim.sdk.client.http.ScimHttpClient
All Implemented Interfaces:
Closeable, AutoCloseable

public class ScimHttpClient extends Object implements Closeable
author: Pascal Knueppel
created at: 09.12.2019 - 12:26

will provide a service for creating pre-configured apache CloseableHttpClients
the configuration added to the created clients are the following
  1. proxy authentication for a configured proxy (see ProxyHelper)
  2. a pre-configured SSLContext. Depends on the specific declarated bean provided by the developer
  • Constructor Details

  • Method Details

    • getHttpClient

      public org.apache.http.impl.client.CloseableHttpClient getHttpClient()
      this method generates a http-client instance and will set the ssl-context
      Returns:
      a http-client instance
    • getRequestConfig

      public org.apache.http.client.config.RequestConfig getRequestConfig()
      will configure the apache http-client
      Returns:
      the original request with an extended configuration
    • sendRequest

      public HttpResponse sendRequest(org.apache.http.client.methods.HttpUriRequest uriRequest)
      this method will send the request with the apache http client and will also handle IOExceptions and wrap them into IORuntimeExceptions
      Parameters:
      uriRequest - the request that should be send
      Returns:
      the response of the server
      Throws:
      SSLHandshakeRuntimeException - in case that the server represented a certificate that is not trusted
      ConnectRuntimeException - happens if the server does not respond (wrong URL wrong port or something else)
      ConnectTimeoutRuntimeException - if the server took too long to establish a connection
      SocketTimeoutRuntimeException - if the server took too long to send the response
      IORuntimeException - base exception that represents all previous mentioned exceptions
    • close

      public void close()
      will close the apache http client
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • getTIMEOUT_MILLIS

      public static int getTIMEOUT_MILLIS()
      Number by which timeout variables are multiplied.
    • getScimClientConfig

      public ScimClientConfig getScimClientConfig()
      reads the timeout in seconds for setting up a connection
      default: 3