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 apacheCloseableHttpClients
the configuration added to the created clients are the following- proxy authentication for a configured proxy (see
ProxyHelper) - a pre-configured
SSLContext. Depends on the specific declarated bean provided by the developer
-
-
Constructor Summary
Constructors Constructor Description ScimHttpClient(ScimClientConfig scimClientConfig)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()will close the apache http clientorg.apache.http.impl.client.CloseableHttpClientgetHttpClient()this method generates a http-client instance and will set the ssl-contextorg.apache.http.client.config.RequestConfiggetRequestConfig()will configure the apache http-clientScimClientConfiggetScimClientConfig()reads the timeout in seconds for setting up a connection
default: 3static intgetTIMEOUT_MILLIS()Number by which timeout variables are multiplied.HttpResponsesendRequest(org.apache.http.client.methods.HttpUriRequest uriRequest)this method will send the request with the apache http client and will also handleIOExceptions and wrap them intoIORuntimeExceptions
-
-
-
Constructor Detail
-
ScimHttpClient
public ScimHttpClient(ScimClientConfig scimClientConfig)
-
-
Method Detail
-
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 handleIOExceptions and wrap them intoIORuntimeExceptions- 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 trustedConnectRuntimeException- happens if the server does not respond (wrong URL wrong port or something else)ConnectTimeoutRuntimeException- if the server took too long to establish a connectionSocketTimeoutRuntimeException- if the server took too long to send the responseIORuntimeException- base exception that represents all previous mentioned exceptions
-
close
public void close()
will close the apache http client- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
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
-
-