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

## Class Http2SolrClient

- java.lang.Object
- - org.apache.solr.client.solrj.SolrClient
  - - org.apache.solr.client.solrj.impl.Http2SolrClient

All Implemented Interfaces:
  `Closeable`, `Serializable`, `AutoCloseable`

    public class Http2SolrClient
    extends SolrClient

Difference between this `Http2SolrClient` and `HttpSolrClient`:

- `Http2SolrClient` sends requests in HTTP/2
- `Http2SolrClient` can point to multiple urls
- `Http2SolrClient` does not expose its internal httpClient like `HttpSolrClient.getHttpClient()`, sharing connection pools should be done by `Http2SolrClient.Builder.withHttpClient(Http2SolrClient)`

See Also:
  Serialized Form
WARNING: This API is experimental and might change in incompatible ways in the next release.

### Nested Class Summary

Nested Classes
`static class` `Http2SolrClient.Builder`
`static class` `Http2SolrClient.OutStream`

### Field Summary

Fields
`static String` `REQ_PRINCIPAL_KEY`
`protected RequestWriter` `requestWriter`

### Constructor Summary

Constructors
`protected` `Http2SolrClient​(String serverBaseUrl, Http2SolrClient.Builder builder)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
`void` `addListenerFactory​(HttpListenerFactory factory)`
`Cancellable` `asyncRequest​(SolrRequest<?> solrReq, String collection, AsyncListener<NamedList<Object>> asyncListener)`
`void` `close()`
`String` `getBaseURL()`
`long` `getIdleTimeout()`
`ResponseParser` `getParser()`
`Set<String>` `getQueryParams()` Deprecated. use `getUrlParamNames()`
`protected RequestWriter` `getRequestWriter()`
`Set<String>` `getUrlParamNames()`
`Http2SolrClient.OutStream` `initOutStream​(String baseUrl, UpdateRequest updateRequest, String collection)`
`boolean` `isV2ApiRequest​(SolrRequest<?> request)`
`NamedList<Object>` `request​(SolrRequest<?> solrRequest, String collection)` Execute a request against a Solr server for a given collection
`static void` `resetSslContextFactory()`
`void` `send​(Http2SolrClient.OutStream outStream, SolrRequest<?> req, String collection)`
`void` `setAuthenticationStore​(org.eclipse.jetty.client.api.AuthenticationStore authenticationStore)`
`static void` `setDefaultSSLConfig​(SSLConfig sslConfig)`
`void` `setFollowRedirects​(boolean follow)` Deprecated. use `Http2SolrClient.Builder.withFollowRedirects(boolean)` Redirects(boolean)} instead
`void` `setParser​(ResponseParser parser)` Deprecated. use `Http2SolrClient.Builder.withResponseParser(ResponseParser)` instead
`void` `setRequestWriter​(RequestWriter requestWriter)` Deprecated. use `Http2SolrClient.Builder.withRequestWriter(RequestWriter)` instead
`void` `setUrlParamNames​(Set<String> urlParamNames)` Deprecated. use `Http2SolrClient.Builder.withTheseParamNamesInTheUrl(Set)` instead
`protected void` `updateDefaultMimeTypeForParser()`

### Methods inherited from class org.apache.solr.client.solrj.SolrClient

`add, add, add, add, add, add, add, add, add, add, addBean, addBean, addBean, addBean, addBeans, addBeans, addBeans, addBeans, addBeans, addBeans, commit, commit, commit, commit, commit, commit, deleteById, deleteById, deleteById, deleteById, deleteById, deleteById, deleteById, deleteById, deleteByQuery, deleteByQuery, deleteByQuery, deleteByQuery, getBinder, getById, getById, getById, getById, getById, getById, getById, getById, getContext, optimize, optimize, optimize, optimize, optimize, optimize, ping, ping, query, query, query, query, queryAndStreamResponse, queryAndStreamResponse, queryAndStreamResponse, request, rollback, rollback`

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

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

### Field Detail

#### REQ_PRINCIPAL_KEY

    public static final String REQ_PRINCIPAL_KEY

See Also:
  Constant Field Values

#### requestWriter

    protected RequestWriter requestWriter

### Constructor Detail

#### Http2SolrClient

    protected Http2SolrClient​(String serverBaseUrl,
                              Http2SolrClient.Builder builder)

### Method Detail

#### addListenerFactory

    public void addListenerFactory​(HttpListenerFactory factory)

#### close

    public void close()

#### setAuthenticationStore

    public void setAuthenticationStore​(org.eclipse.jetty.client.api.AuthenticationStore authenticationStore)

#### isV2ApiRequest

    public boolean isV2ApiRequest​(SolrRequest<?> request)

#### getIdleTimeout

    public long getIdleTimeout()

#### initOutStream

    public Http2SolrClient.OutStream initOutStream​(String baseUrl,
                                                   UpdateRequest updateRequest,
                                                   String collection)
                                            throws IOException

Throws:
  `IOException`

#### send

    public void send​(Http2SolrClient.OutStream outStream,
                     SolrRequest<?> req,
                     String collection)
              throws IOException

Throws:
  `IOException`

#### asyncRequest

    public Cancellable asyncRequest​(SolrRequest<?> solrReq,
                                    String collection,
                                    AsyncListener<NamedList<Object>> asyncListener)

#### request

    public NamedList<Object> request​(SolrRequest<?> solrRequest,
                                     String collection)
                              throws SolrServerException,
                                     IOException

Description copied from class: `SolrClient`
Execute a request against a Solr server for a given collection

Specified by:
  `request` in class `SolrClient`
Parameters:
  `solrRequest` - the request to execute
  `collection` - the collection to execute the request against
Returns:
  a `NamedList` containing the response from the server
Throws:
  `SolrServerException` - if there is an error on the server
  `IOException` - If there is a low-level I/O error.

#### setRequestWriter

    @Deprecated
    public void setRequestWriter​(RequestWriter requestWriter)

Deprecated.
use `Http2SolrClient.Builder.withRequestWriter(RequestWriter)` instead
Choose the `RequestWriter` to use.

By default, `BinaryRequestWriter` is used.

Note: This setter method is not thread-safe.

#### getRequestWriter

    protected RequestWriter getRequestWriter()

#### setFollowRedirects

    @Deprecated
    public void setFollowRedirects​(boolean follow)

Deprecated.
use `Http2SolrClient.Builder.withFollowRedirects(boolean)` Redirects(boolean)} instead
Configure whether the client should follow redirects or not.

This defaults to false under the assumption that if you are following a redirect to get to a Solr installation, something is configured wrong somewhere.

#### getBaseURL

    public String getBaseURL()

#### getQueryParams

    @Deprecated
    public Set<String> getQueryParams()

Deprecated.
use `getUrlParamNames()`

#### getUrlParamNames

    public Set<String> getUrlParamNames()

#### setUrlParamNames

    @Deprecated
    public void setUrlParamNames​(Set<String> urlParamNames)

Deprecated.
use `Http2SolrClient.Builder.withTheseParamNamesInTheUrl(Set)` instead
Expert Method

Parameters:
  `urlParamNames` - set of param keys that are only sent via the query string. Note that the param will be sent as a query string if the key is part of this Set or the SolrRequest's query params.
See Also:
  `SolrRequest.getQueryParams()`

#### getParser

    public ResponseParser getParser()

#### setParser

    @Deprecated
    public void setParser​(ResponseParser parser)

Deprecated.
use `Http2SolrClient.Builder.withResponseParser(ResponseParser)` instead
Note: This setter method is not thread-safe.

Parameters:
  `parser` - Default Response Parser chosen to parse the response if the parser were not specified as part of the request.
See Also:
  `SolrRequest.getResponseParser()`

#### updateDefaultMimeTypeForParser

    protected void updateDefaultMimeTypeForParser()

#### setDefaultSSLConfig

    public static void setDefaultSSLConfig​(SSLConfig sslConfig)

#### resetSslContextFactory

    public static void resetSslContextFactory()