Class HttpClientUtil


  • public class HttpClientUtil
    extends Object
    Utility class for creating/configuring httpclient instances. This class can touch internal HttpClient details and is subject to change.
    WARNING: This API is experimental and might change in incompatible ways in the next release.
    • Constructor Detail

      • HttpClientUtil

        public HttpClientUtil()
    • Method Detail

      • setHttpClientBuilder

        public static void setHttpClientBuilder​(SolrHttpClientBuilder newHttpClientBuilder)
      • setHttpClientProvider

        public static void setHttpClientProvider​(SolrHttpClientBuilder newHttpClientBuilder)
      • resetHttpClientBuilder

        public static void resetHttpClientBuilder()
      • createClient

        public static org.apache.http.impl.client.CloseableHttpClient createClient​(SolrParams params)
        Creates new http client by using the provided configuration.
        Parameters:
        params - http client configuration, if null a client with default configuration (no additional configuration) is created.
      • createClient

        public static org.apache.http.impl.client.CloseableHttpClient createClient​(SolrParams params,
                                                                                   org.apache.http.impl.conn.PoolingHttpClientConnectionManager cm)
      • createClient

        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)
      • createClient

        public 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.
      • close

        public static void close​(org.apache.http.client.HttpClient httpClient)
      • addRequestInterceptor

        public static void addRequestInterceptor​(org.apache.http.HttpRequestInterceptor interceptor)
      • removeRequestInterceptor

        public static void removeRequestInterceptor​(org.apache.http.HttpRequestInterceptor interceptor)
      • clearRequestInterceptors

        public static void clearRequestInterceptors()
      • setHttpClientRequestContextBuilder

        public static void setHttpClientRequestContextBuilder​(SolrHttpClientContextBuilder httpClientContextBuilder)
      • createNewHttpClientRequestContext

        public static org.apache.http.client.protocol.HttpClientContext createNewHttpClientRequestContext()
        Create a HttpClientContext object and HttpClientContext.setUserToken(Object) to an internal singleton. It allows to reuse underneath HttpClient in connection pools if client authentication is enabled.
      • createDefaultRequestConfigBuilder

        public static org.apache.http.client.config.RequestConfig.Builder createDefaultRequestConfigBuilder()
      • setCookiePolicy

        public static void setCookiePolicy​(String policyName)