public class HttpClientUtil extends Object
Modifier and Type | Class and Description |
---|---|
static class |
HttpClientUtil.SchemaRegistryProvider |
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_CONNECT_TIMEOUT |
static int |
DEFAULT_MAXCONNECTIONS |
static int |
DEFAULT_MAXCONNECTIONSPERHOST |
static int |
DEFAULT_SO_TIMEOUT |
static String |
PROP_ALLOW_COMPRESSION |
static String |
PROP_BASIC_AUTH_PASS |
static String |
PROP_BASIC_AUTH_USER |
static String |
PROP_CONNECTION_TIMEOUT |
static String |
PROP_FOLLOW_REDIRECTS |
static String |
PROP_MAX_CONNECTIONS |
static String |
PROP_MAX_CONNECTIONS_PER_HOST |
static String |
PROP_SO_TIMEOUT |
static String |
PROP_USE_RETRY |
static String |
SYS_PROP_CHECK_PEER_NAME
System property consulted to determine if the default
HttpClientUtil.SchemaRegistryProvider
will require hostname validation of SSL Certificates. |
static String |
SYS_PROP_HTTP_CLIENT_BUILDER_FACTORY
A Java system property to select the HttpClientBuilderFactory used for
configuring the HttpClientBuilder instance by default.
|
Constructor and Description |
---|
HttpClientUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
addRequestInterceptor(org.apache.http.HttpRequestInterceptor interceptor) |
static void |
clearRequestInterceptors() |
static void |
close(org.apache.http.client.HttpClient httpClient) |
static org.apache.http.impl.client.CloseableHttpClient |
createClient(SolrParams params)
Creates new http client by using the provided configuration.
|
static org.apache.http.impl.client.CloseableHttpClient |
createClient(SolrParams params,
org.apache.http.impl.conn.PoolingHttpClientConnectionManager cm) |
static org.apache.http.impl.client.CloseableHttpClient |
createClient(SolrParams params,
org.apache.http.impl.conn.PoolingHttpClientConnectionManager cm,
boolean sharedConnectionManager)
Creates new http client by using the provided configuration.
|
static org.apache.http.impl.client.CloseableHttpClient |
createClient(SolrParams params,
org.apache.http.impl.conn.PoolingHttpClientConnectionManager cm,
boolean sharedConnectionManager,
org.apache.http.protocol.HttpRequestExecutor httpRequestExecutor) |
static org.apache.http.client.config.RequestConfig.Builder |
createDefaultRequestConfigBuilder() |
static org.apache.http.client.protocol.HttpClientContext |
createNewHttpClientRequestContext()
Create a HttpClientContext object and
HttpClientContext.setUserToken(Object)
to an internal singleton. |
static SolrHttpClientBuilder |
getHttpClientBuilder() |
static HttpClientUtil.SchemaRegistryProvider |
getSchemaRegisteryProvider() |
static void |
removeRequestInterceptor(org.apache.http.HttpRequestInterceptor interceptor) |
static void |
resetHttpClientBuilder() |
static void |
setCookiePolicy(String policyName) |
static void |
setHttpClientBuilder(SolrHttpClientBuilder newHttpClientBuilder) |
static void |
setHttpClientProvider(SolrHttpClientBuilder newHttpClientBuilder) |
static void |
setHttpClientRequestContextBuilder(SolrHttpClientContextBuilder httpClientContextBuilder) |
static void |
setSchemaRegistryProvider(HttpClientUtil.SchemaRegistryProvider newRegistryProvider) |
public static final int DEFAULT_CONNECT_TIMEOUT
public static final int DEFAULT_SO_TIMEOUT
public static final int DEFAULT_MAXCONNECTIONSPERHOST
public static final int DEFAULT_MAXCONNECTIONS
public static final String PROP_MAX_CONNECTIONS_PER_HOST
public static final String PROP_MAX_CONNECTIONS
public static final String PROP_USE_RETRY
public static final String PROP_ALLOW_COMPRESSION
public static final String PROP_BASIC_AUTH_USER
public static final String PROP_BASIC_AUTH_PASS
public static final String SYS_PROP_CHECK_PEER_NAME
HttpClientUtil.SchemaRegistryProvider
will require hostname validation of SSL Certificates. The default behavior is to enforce
peer name validation.
This property will have no effect if setSchemaRegistryProvider(org.apache.solr.client.solrj.impl.HttpClientUtil.SchemaRegistryProvider)
is used to override
the default HttpClientUtil.SchemaRegistryProvider
public static final String PROP_FOLLOW_REDIRECTS
public static final String PROP_SO_TIMEOUT
public static final String PROP_CONNECTION_TIMEOUT
public static final String SYS_PROP_HTTP_CLIENT_BUILDER_FACTORY
public static void setHttpClientBuilder(SolrHttpClientBuilder newHttpClientBuilder)
public static void setHttpClientProvider(SolrHttpClientBuilder newHttpClientBuilder)
public static void setSchemaRegistryProvider(HttpClientUtil.SchemaRegistryProvider newRegistryProvider)
SYS_PROP_CHECK_PEER_NAME
public static SolrHttpClientBuilder getHttpClientBuilder()
public static HttpClientUtil.SchemaRegistryProvider getSchemaRegisteryProvider()
SYS_PROP_CHECK_PEER_NAME
public static void resetHttpClientBuilder()
public static org.apache.http.impl.client.CloseableHttpClient createClient(SolrParams params)
params
- http client configuration, if null a client with default
configuration (no additional configuration) is created.public static org.apache.http.impl.client.CloseableHttpClient createClient(SolrParams params, org.apache.http.impl.conn.PoolingHttpClientConnectionManager cm)
public static org.apache.http.impl.client.CloseableHttpClient createClient(SolrParams params, org.apache.http.impl.conn.PoolingHttpClientConnectionManager cm, boolean sharedConnectionManager, org.apache.http.protocol.HttpRequestExecutor httpRequestExecutor)
public static org.apache.http.impl.client.CloseableHttpClient createClient(SolrParams params, org.apache.http.impl.conn.PoolingHttpClientConnectionManager cm, boolean sharedConnectionManager)
public static void close(org.apache.http.client.HttpClient httpClient)
public static void addRequestInterceptor(org.apache.http.HttpRequestInterceptor interceptor)
public static void removeRequestInterceptor(org.apache.http.HttpRequestInterceptor interceptor)
public static void clearRequestInterceptors()
public static void setHttpClientRequestContextBuilder(SolrHttpClientContextBuilder httpClientContextBuilder)
public static org.apache.http.client.protocol.HttpClientContext createNewHttpClientRequestContext()
HttpClientContext.setUserToken(Object)
to an internal singleton. It allows to reuse underneath HttpClient
in connection pools if client authentication is enabled.public static org.apache.http.client.config.RequestConfig.Builder createDefaultRequestConfigBuilder()
public static void setCookiePolicy(String policyName)
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.