public class HttpClientConfigurer extends Object
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()
.
Modifier | Constructor and Description |
---|---|
protected |
HttpClientConfigurer() |
Modifier and Type | Method and Description |
---|---|
HttpClientConfigurer |
addInterceptor(org.apache.http.HttpRequestInterceptor interceptor) |
HttpClientConfigurer |
basicAuthCredentials(String username,
String password) |
org.springframework.http.client.ClientHttpRequestFactory |
buildClientHttpRequestFactory() |
org.apache.http.impl.client.CloseableHttpClient |
buildHttpClient() |
static HttpClientConfigurer |
create() |
HttpClientConfigurer |
skipTlsCertificateVerification()
Sets the client's
SSLContext to use
HttpUtils.buildCertificateIgnoringSslContext() . |
HttpClientConfigurer |
skipTlsCertificateVerification(boolean skipTlsCertificateVerification) |
HttpClientConfigurer |
targetHost(URI targetHost) |
public static HttpClientConfigurer create()
public HttpClientConfigurer basicAuthCredentials(String username, String password)
public HttpClientConfigurer skipTlsCertificateVerification()
SSLContext
to use
HttpUtils.buildCertificateIgnoringSslContext()
.this
to enable chained method invocationpublic HttpClientConfigurer skipTlsCertificateVerification(boolean skipTlsCertificateVerification)
public HttpClientConfigurer targetHost(URI targetHost)
public HttpClientConfigurer addInterceptor(org.apache.http.HttpRequestInterceptor interceptor)
public org.apache.http.impl.client.CloseableHttpClient buildHttpClient()
public org.springframework.http.client.ClientHttpRequestFactory buildClientHttpRequestFactory()
Copyright © 2018 Pivotal Software, Inc.. All rights reserved.