Class SslAwareApacheRestfulClient5Factory
java.lang.Object
ca.uhn.fhir.rest.client.impl.RestfulClientFactory
org.openehealth.ipf.commons.ihe.fhir.SslAwareAbstractRestfulClientFactory<HttpClient5Builder>
org.openehealth.ipf.commons.ihe.fhir.SslAwareApacheRestfulClient5Factory
- All Implemented Interfaces:
IRestfulClientFactory
public class SslAwareApacheRestfulClient5Factory
extends SslAwareAbstractRestfulClientFactory<HttpClient5Builder>
RestfulClientFactory based on Apache HttpClient5 that is aware of SSL context parameters. Note that with
Spring 6, its RestTemplate also works with HttpClient5, so this is an option to reduce the number of
HTTP client libraries.
- Author:
- Christian Ohr
-
Field Summary
Fields inherited from interface ca.uhn.fhir.rest.client.api.IRestfulClientFactory
DEFAULT_CONNECT_TIMEOUT, DEFAULT_CONNECTION_REQUEST_TIMEOUT, DEFAULT_CONNECTION_TTL, DEFAULT_POOL_MAX, DEFAULT_POOL_MAX_PER_ROUTE, DEFAULT_SERVER_VALIDATION_MODE, DEFAULT_SOCKET_TIMEOUT
-
Constructor Summary
ConstructorDescriptionSslAwareApacheRestfulClient5Factory
(FhirContext theFhirContext) SslAwareApacheRestfulClient5Factory
(FhirContext fhirContext, HttpClient5Builder httpClientBuilder) -
Method Summary
Modifier and TypeMethodDescriptionprotected IHttpClient
getHttpClient
(String serverBase) getHttpClient
(StringBuilder url, Map<String, List<String>> ifNoneExistParams, String ifNoneExistString, RequestTypeEnum requestType, List<Header> headers) protected org.apache.hc.client5.http.impl.classic.CloseableHttpClient
initializeSecurityInformation
(boolean enabled, SSLContext sslContext, HostnameVerifier hostnameVerifier, String userName, String password) protected HttpClient5Builder
protected void
void
setHttpClient
(Object httpClient) Sets a completely configured HttpClient to be used.void
Methods inherited from class org.openehealth.ipf.commons.ihe.fhir.SslAwareAbstractRestfulClientFactory
customizeHttpClientBuilder, getSecurityInformation, httpClientBuilder, setSecurityInformation
Methods inherited from class ca.uhn.fhir.rest.client.impl.RestfulClientFactory
getConnectionRequestTimeout, getConnectionTimeToLive, getConnectTimeout, getFhirContext, getPoolMaxPerRoute, getPoolMaxTotal, getProxyPassword, getProxyUsername, getServerValidationMode, getServerValidationModeEnum, getSocketTimeout, newClient, newGenericClient, setConnectionRequestTimeout, setConnectionTimeToLive, setConnectTimeout, setFhirContext, setPoolMaxPerRoute, setPoolMaxTotal, setProxyCredentials, setServerValidationMode, setServerValidationModeEnum, setSocketTimeout, validateConfigured, validateServerBase, validateServerBaseIfConfiguredToDoSo
-
Constructor Details
-
SslAwareApacheRestfulClient5Factory
-
SslAwareApacheRestfulClient5Factory
public SslAwareApacheRestfulClient5Factory(FhirContext fhirContext, HttpClient5Builder httpClientBuilder)
-
-
Method Details
-
getHttpClient
- Specified by:
getHttpClient
in classRestfulClientFactory
-
resetHttpClient
protected void resetHttpClient()- Specified by:
resetHttpClient
in classRestfulClientFactory
-
getHttpClient
public IHttpClient getHttpClient(StringBuilder url, Map<String, List<String>> ifNoneExistParams, String ifNoneExistString, RequestTypeEnum requestType, List<Header> headers) -
setHttpClient
Sets a completely configured HttpClient to be used. No further configuration is done (timeouts, security etc.) before it is used.- Parameters:
httpClient
- Http client instance
-
setProxy
-
newHttpClientBuilder
- Specified by:
newHttpClientBuilder
in classSslAwareAbstractRestfulClientFactory<HttpClient5Builder>
-
getNativeHttpClient
protected org.apache.hc.client5.http.impl.classic.CloseableHttpClient getNativeHttpClient() -
initializeSecurityInformation
public FhirSecurityInformation<HttpClient5Builder> initializeSecurityInformation(boolean enabled, SSLContext sslContext, HostnameVerifier hostnameVerifier, String userName, String password) - Specified by:
initializeSecurityInformation
in classSslAwareAbstractRestfulClientFactory<HttpClient5Builder>
-