Package org.apache.solr.client.solrj.impl

## Class Http2SolrClient.Builder

- java.lang.Object
- - org.apache.solr.client.solrj.impl.HttpSolrClientBuilderBase<Http2SolrClient.Builder,​Http2SolrClient>
  - - org.apache.solr.client.solrj.impl.Http2SolrClient.Builder

Enclosing class:
  Http2SolrClient

    public static class Http2SolrClient.Builder
    extends HttpSolrClientBuilderBase<Http2SolrClient.Builder,​Http2SolrClient>

### Field Summary

Fields
`protected CookieStore` `cookieStore`
`protected Long` `keyStoreReloadIntervalSecs`

### Fields inherited from class org.apache.solr.client.solrj.impl.HttpSolrClientBuilderBase

`baseSolrUrl, basicAuthAuthorizationStr, connectionTimeoutMillis, defaultCollection, executor, followRedirects, idleTimeoutMillis, maxConnectionsPerHost, proxyHost, proxyIsSecure, proxyIsSocks4, proxyPort, requestTimeoutMillis, requestWriter, responseParser, urlParamNames, useHttp1_1`

### Constructor Summary

Constructors
`Builder()`
`Builder​(String baseSolrUrl)` Create a Builder object, based on the provided Solr URL.

### Method Summary

All Methods Instance Methods Concrete Methods Deprecated Methods
`Http2SolrClient` `build()`
`protected <B extends HttpSolrClientBase> B` `build​(Class<B> type)`
`Http2SolrClient.Builder` `connectionTimeout​(int connectionTimeout)` Deprecated. Please use `HttpSolrClientBuilderBase.withConnectionTimeout(long, TimeUnit)`
`Http2SolrClient.Builder` `idleTimeout​(int idleConnectionTimeout)` Deprecated. Please use `HttpSolrClientBuilderBase.withIdleTimeout(long, TimeUnit)`
`Http2SolrClient.Builder` `maxConnectionsPerHost​(int max)` Deprecated. Please use `HttpSolrClientBuilderBase.withMaxConnectionsPerHost(int)`
`Http2SolrClient.Builder` `requestTimeout​(int requestTimeout)` Deprecated. Please use `HttpSolrClientBuilderBase.withRequestTimeout(long, TimeUnit)`
`Http2SolrClient.Builder` `withCookieStore​(CookieStore cookieStore)` Set a cookieStore other than the default (`java.net.InMemoryCookieStore`)
`Http2SolrClient.Builder` `withHttpClient​(Http2SolrClient http2SolrClient)` Provide a seed Http2SolrClient for the builder values, values can still be overridden by using builder methods
`Http2SolrClient.Builder` `withKeyStoreReloadInterval​(long interval, TimeUnit unit)` Set the scanning interval to check for updates in the Key Store used by this client.
`HttpSolrClientBuilderBase<Http2SolrClient.Builder,​Http2SolrClient>` `withSSLConfig​(SSLConfig sslConfig)`

### Methods inherited from class org.apache.solr.client.solrj.impl.HttpSolrClientBuilderBase

`getConnectionTimeout, getIdleTimeoutMillis, useHttp1_1, withBasicAuthCredentials, withConnectionTimeout, withDefaultCollection, withExecutor, withFollowRedirects, withIdleTimeout, withMaxConnectionsPerHost, withOptionalBasicAuthCredentials, withProxyConfiguration, withRequestTimeout, withRequestWriter, withResponseParser, withTheseParamNamesInTheUrl`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### cookieStore

    protected CookieStore cookieStore

#### keyStoreReloadIntervalSecs

    protected Long keyStoreReloadIntervalSecs

### Constructor Detail

#### Builder

    public Builder()

#### Builder

    public Builder​(String baseSolrUrl)

Create a Builder object, based on the provided Solr URL.

Two different paths can be specified as a part of this URL:

1) A path pointing directly at a particular core

       SolrClient client = new Http2SolrClient.Builder("http://my-solr-server:8983/solr/core1").build();
       QueryResponse resp = client.query(new SolrQuery("*:*"));

Note that when a core is provided in the base URL, queries and other requests can be made without mentioning the core explicitly. However, the client can only send requests to that core. Attempts to make core-agnostic requests, or requests for other cores will fail.

Use of these core-based URLs is deprecated and will not be supported in Solr 10.0 Users should instead provide base URLs as described below, and provide a "default collection" as desired using `HttpSolrClientBuilderBase.withDefaultCollection(String)`

2) The path of the root Solr path ("/solr")

       SolrClient client = new Http2SolrClient.Builder("http://my-solr-server:8983/solr").build();
       QueryResponse resp = client.query("core1", new SolrQuery("*:*"));

In this case the client is more flexible and can be used to send requests to any cores. Users can still provide a "default" collection if desired through use of `HttpSolrClientBuilderBase.withDefaultCollection(String)`.

By default, compression is not enabled on created HttpSolrClient objects. By default, redirects are not followed in created HttpSolrClient objects. By default, `BinaryRequestWriter` is used for composing requests. By default, `BinaryResponseParser` is used for parsing responses.

Parameters:
  `baseSolrUrl` - the base URL of the Solr server that will be targeted by any created clients.

### Method Detail

#### withSSLConfig

    public HttpSolrClientBuilderBase<Http2SolrClient.Builder,​Http2SolrClient> withSSLConfig​(SSLConfig sslConfig)

#### maxConnectionsPerHost

    @Deprecated(since="9.2")
    public Http2SolrClient.Builder maxConnectionsPerHost​(int max)

Deprecated.
Please use `HttpSolrClientBuilderBase.withMaxConnectionsPerHost(int)`
Set maxConnectionsPerHost for http1 connections, maximum number http2 connections is limited to 4

#### withKeyStoreReloadInterval

    public Http2SolrClient.Builder withKeyStoreReloadInterval​(long interval,
                                                              TimeUnit unit)

Set the scanning interval to check for updates in the Key Store used by this client. If the interval is unset, 0 or less, then the Key Store Scanner is not created, and the client will not attempt to update key stores. The minimum value between checks is 1 second.

Parameters:
  `interval` - Interval between checks
  `unit` - The unit for the interval
Returns:
  This builder

#### idleTimeout

    @Deprecated(since="9.2")
    public Http2SolrClient.Builder idleTimeout​(int idleConnectionTimeout)

Deprecated.
Please use `HttpSolrClientBuilderBase.withIdleTimeout(long, TimeUnit)`

#### connectionTimeout

    @Deprecated(since="9.2")
    public Http2SolrClient.Builder connectionTimeout​(int connectionTimeout)

Deprecated.
Please use `HttpSolrClientBuilderBase.withConnectionTimeout(long, TimeUnit)`

#### requestTimeout

    @Deprecated(since="9.2")
    public Http2SolrClient.Builder requestTimeout​(int requestTimeout)

Deprecated.
Please use `HttpSolrClientBuilderBase.withRequestTimeout(long, TimeUnit)`
Set a timeout in milliseconds for requests issued by this client.

Parameters:
  `requestTimeout` - The timeout in milliseconds
Returns:
  this Builder.

#### build

    protected <B extends HttpSolrClientBase> B build​(Class<B> type)

#### build

    public Http2SolrClient build()

Specified by:
  `build` in class `HttpSolrClientBuilderBase<Http2SolrClient.Builder,​Http2SolrClient>`

#### withHttpClient

    public Http2SolrClient.Builder withHttpClient​(Http2SolrClient http2SolrClient)

Provide a seed Http2SolrClient for the builder values, values can still be overridden by using builder methods

#### withCookieStore

    public Http2SolrClient.Builder withCookieStore​(CookieStore cookieStore)

Set a cookieStore other than the default (`java.net.InMemoryCookieStore`)

Parameters:
  `cookieStore` - The CookieStore to set. `null` will set the default.
Returns:
  this Builder