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

## Class HttpSolrClient

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

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

Direct Known Subclasses:
  `DelegationTokenHttpSolrClient`

    @Deprecated(since="9.0")
    public class HttpSolrClient
    extends BaseHttpSolrClient

Deprecated.
Please use `Http2SolrClient`
A SolrClient implementation that talks directly to a Solr server via Apache HTTP client

See Also:
  Serialized Form

### Nested Class Summary

Nested Classes
`static class` `HttpSolrClient.Builder` Deprecated. Please use `Http2SolrClient`
`static class` `HttpSolrClient.HttpUriRequestResponse` Deprecated.

### Nested classes/interfaces inherited from class org.apache.solr.client.solrj.impl.BaseHttpSolrClient

`BaseHttpSolrClient.RemoteExecutionException, BaseHttpSolrClient.RemoteSolrException`

### Field Summary

Fields
`static String` `AGENT` Deprecated. User-Agent String.
`protected String` `baseUrl` Deprecated. The URL of the Solr server.
`protected ModifiableSolrParams` `invariantParams` Deprecated. Default value: null / empty.
`protected ResponseParser` `parser` Deprecated. Default response parser is BinaryResponseParser
`protected RequestWriter` `requestWriter` Deprecated. The RequestWriter used to write all requests to Solr
`protected static Set<Integer>` `UNMATCHED_ACCEPTED_ERROR_CODES` Deprecated.

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

`defaultCollection`

### Constructor Summary

Constructors
`protected` `HttpSolrClient​(HttpSolrClient.Builder builder)` Deprecated. Use the builder to create this client

### Method Summary

All Methods Instance Methods Concrete Methods Deprecated Methods
`protected ModifiableSolrParams` `calculateQueryParams​(Set<String> queryParamNames, ModifiableSolrParams wparams)` Deprecated.
`void` `close()` Deprecated. Close the `HttpClientConnectionManager` from the internal client.
`protected org.apache.http.client.methods.HttpRequestBase` `createMethod​(SolrRequest<?> request, String collection)` Deprecated.
`protected NamedList<Object>` `executeMethod​(org.apache.http.client.methods.HttpRequestBase method, Principal userPrincipal, ResponseParser processor, boolean isV2Api)` Deprecated.
`String` `getBaseURL()` Deprecated.
`org.apache.http.client.HttpClient` `getHttpClient()` Deprecated. Return the HttpClient this instance uses.
`ModifiableSolrParams` `getInvariantParams()` Deprecated. Retrieve the default list of parameters are added to every request regardless.
`ResponseParser` `getParser()` Deprecated.
`Set<String>` `getQueryParams()` Deprecated. use `getUrlParamNames()`
`Set<String>` `getUrlParamNames()` Deprecated.
`HttpSolrClient.HttpUriRequestResponse` `httpUriRequest​(SolrRequest<?> request)` Deprecated.
`HttpSolrClient.HttpUriRequestResponse` `httpUriRequest​(SolrRequest<?> request, ResponseParser processor)` Deprecated.
`boolean` `isUseMultiPartPost()` Deprecated.
`NamedList<Object>` `request​(SolrRequest<?> request, String collection)` Deprecated. Process the request.
`NamedList<Object>` `request​(SolrRequest<?> request, ResponseParser processor)` Deprecated.
`NamedList<Object>` `request​(SolrRequest<?> request, ResponseParser processor, String collection)` Deprecated.
`void` `setBaseURL​(String baseUrl)` Deprecated. use `HttpSolrClient.Builder` instead
`void` `setFollowRedirects​(boolean followRedirects)` Deprecated. use `SolrClientBuilder.withFollowRedirects(boolean)` Redirects(boolean)} instead
`void` `setParser​(ResponseParser parser)` Deprecated. use `SolrClientBuilder.withResponseParser(ResponseParser)` instead
`void` `setRequestWriter​(RequestWriter requestWriter)` Deprecated. use `SolrClientBuilder.withRequestWriter(RequestWriter)` instead
`void` `setUseMultiPartPost​(boolean useMultiPartPost)` Deprecated. use `SolrClientBuilder.allowMultiPartPost(Boolean)` instead

### 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, getDefaultCollection, 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

#### UNMATCHED_ACCEPTED_ERROR_CODES

    protected static final Set<Integer> UNMATCHED_ACCEPTED_ERROR_CODES

Deprecated.

#### AGENT

    public static final String AGENT

Deprecated.
User-Agent String.

#### baseUrl

    protected volatile String baseUrl

Deprecated.
The URL of the Solr server.

#### invariantParams

    protected ModifiableSolrParams invariantParams

Deprecated.
Default value: null / empty.

Parameters that are added to every request regardless. This may be a place to add something like an authentication token.

#### parser

    protected volatile ResponseParser parser

Deprecated.
Default response parser is BinaryResponseParser

This parser represents the default Response Parser chosen to parse the response if the parser were not specified as part of the request.

See Also:
  `BinaryResponseParser`

#### requestWriter

    protected volatile RequestWriter requestWriter

Deprecated.
The RequestWriter used to write all requests to Solr

See Also:
  `RequestWriter`

### Constructor Detail

#### HttpSolrClient

    protected HttpSolrClient​(HttpSolrClient.Builder builder)

Deprecated.
Use the builder to create this client

### Method Detail

#### getQueryParams

    @Deprecated
    public Set<String> getQueryParams()

Deprecated.
use `getUrlParamNames()`

#### getUrlParamNames

    public Set<String> getUrlParamNames()

Deprecated.

#### request

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

Deprecated.
Process the request. If `SolrRequest.getResponseParser()` is null, then use `getParser()`

Specified by:
  `request` in class `SolrClient`
Parameters:
  `request` - The `SolrRequest` to process
  `collection` - the collection to execute the request against
Returns:
  The `NamedList` result
Throws:
  `IOException` - If there is a low-level I/O error.
  `SolrServerException` - if there is an error on the server
See Also:
  `request(org.apache.solr.client.solrj.SolrRequest, org.apache.solr.client.solrj.ResponseParser)`

#### request

    public NamedList<Object> request​(SolrRequest<?> request,
                                     ResponseParser processor)
                              throws SolrServerException,
                                     IOException

Deprecated.

Throws:
  `SolrServerException`
  `IOException`

#### request

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

Deprecated.

Throws:
  `SolrServerException`
  `IOException`

#### httpUriRequest

    public HttpSolrClient.HttpUriRequestResponse httpUriRequest​(SolrRequest<?> request)
                                                         throws SolrServerException,
                                                                IOException

Deprecated.

Throws:
  `SolrServerException`
  `IOException`
WARNING: This API is experimental and might change in incompatible ways in the next release.

#### httpUriRequest

    public HttpSolrClient.HttpUriRequestResponse httpUriRequest​(SolrRequest<?> request,
                                                                ResponseParser processor)
                                                         throws SolrServerException,
                                                                IOException

Deprecated.

Throws:
  `SolrServerException`
  `IOException`
WARNING: This API is experimental and might change in incompatible ways in the next release.

#### calculateQueryParams

    protected ModifiableSolrParams calculateQueryParams​(Set<String> queryParamNames,
                                                        ModifiableSolrParams wparams)

Deprecated.

#### createMethod

    protected org.apache.http.client.methods.HttpRequestBase createMethod​(SolrRequest<?> request,
                                                                          String collection)
                                                                   throws IOException,
                                                                          SolrServerException

Deprecated.

Throws:
  `IOException`
  `SolrServerException`

#### executeMethod

    protected NamedList<Object> executeMethod​(org.apache.http.client.methods.HttpRequestBase method,
                                              Principal userPrincipal,
                                              ResponseParser processor,
                                              boolean isV2Api)
                                       throws SolrServerException

Deprecated.

Throws:
  `SolrServerException`

#### getInvariantParams

    public ModifiableSolrParams getInvariantParams()

Deprecated.
Retrieve the default list of parameters are added to every request regardless.

See Also:
  `invariantParams`

#### getBaseURL

    public String getBaseURL()

Deprecated.

#### setBaseURL

    @Deprecated
    public void setBaseURL​(String baseUrl)

Deprecated.
use `HttpSolrClient.Builder` instead
Change the base-url used when sending requests to Solr.

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

1) A path pointing directly at a particular core

       httpSolrClient.setBaseURL("http://my-solr-server:8983/solr/core1");
       QueryResponse resp = httpSolrClient.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.

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

       httpSolrClient.setBaseURL("http://my-solr-server:8983/solr");
       QueryResponse resp = httpSolrClient.query("core1", new SolrQuery("*:*"));

In this case the client is more flexible and can be used to send requests to any cores. The cost of this is that the core must be specified on each request.

`SolrClient` setters can be unsafe when the involved `SolrClient` is used in multiple threads simultaneously.

#### getParser

    public ResponseParser getParser()

Deprecated.

#### setParser

    @Deprecated
    public void setParser​(ResponseParser parser)

Deprecated.
use `SolrClientBuilder.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()`

#### getHttpClient

    public org.apache.http.client.HttpClient getHttpClient()

Deprecated.
Return the HttpClient this instance uses.

#### setFollowRedirects

    @Deprecated
    public void setFollowRedirects​(boolean followRedirects)

Deprecated.
use `SolrClientBuilder.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.

#### setRequestWriter

    @Deprecated
    public void setRequestWriter​(RequestWriter requestWriter)

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

By default, `BinaryRequestWriter` is used.

Note: This setter method is not thread-safe.

#### close

    public void close()
               throws IOException

Deprecated.
Close the `HttpClientConnectionManager` from the internal client.

Throws:
  `IOException`

#### isUseMultiPartPost

    public boolean isUseMultiPartPost()

Deprecated.

#### setUseMultiPartPost

    @Deprecated
    public void setUseMultiPartPost​(boolean useMultiPartPost)

Deprecated.
use `SolrClientBuilder.allowMultiPartPost(Boolean)` instead
Set the multipart connection properties

Note: This setter method is not thread-safe.