Class HttpClientConfigurer
java.lang.Object
org.springframework.cloud.dataflow.rest.util.HttpClientConfigurer
Utility for configuring a
CloseableHttpClient
. This class allows for
chained method invocation. If both basic auth credentials and a target host
are provided, the HTTP client will aggressively send the credentials
without having to receive an HTTP 401 response first.
This class can also be used to configure the client used by
RestTemplate
using
buildClientHttpRequestFactory()
.
- Author:
- Mike Heath, Gunnar Hillert
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddInterceptor
(org.apache.hc.core5.http.HttpRequestInterceptor interceptor) basicAuthCredentials
(String username, String password) org.apache.hc.client5.http.impl.classic.CloseableHttpClient
static HttpClientConfigurer
Sets the client'sSSLContext
to useHttpUtils.buildCertificateIgnoringSslContext()
.skipTlsCertificateVerification
(boolean skipTlsCertificateVerification) withProxyCredentials
(URI proxyUri, String proxyUsername, String proxyPassword) Configures theHttpClientBuilder
with a proxy host.
-
Constructor Details
-
HttpClientConfigurer
-
-
Method Details
-
create
-
basicAuthCredentials
-
withProxyCredentials
public HttpClientConfigurer withProxyCredentials(URI proxyUri, String proxyUsername, String proxyPassword) Configures theHttpClientBuilder
with a proxy host. If theproxyUsername
andproxyPassword
are notnull
then aCredentialsProvider
is also configured for the proxy host.- Parameters:
proxyUri
- Must not be null and must be configured with a scheme (http or https).proxyUsername
- May be nullproxyPassword
- May be null- Returns:
- a reference to
this
to enable chained method invocation
-
skipTlsCertificateVerification
Sets the client'sSSLContext
to useHttpUtils.buildCertificateIgnoringSslContext()
.- Returns:
- a reference to
this
to enable chained method invocation
-
skipTlsCertificateVerification
-
addInterceptor
public HttpClientConfigurer addInterceptor(org.apache.hc.core5.http.HttpRequestInterceptor interceptor) -
buildHttpClient
public org.apache.hc.client5.http.impl.classic.CloseableHttpClient buildHttpClient() -
buildClientHttpRequestFactory
-