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

# Class HttpSolrClientBase

java.lang.Object
org.apache.solr.client.solrj.SolrClient
org.apache.solr.client.solrj.impl.HttpSolrClientBase

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

Direct Known Subclasses:
  `HttpJdkSolrClient`

public abstract class HttpSolrClientBase extends SolrClient
Utility/base functionality for direct HTTP client implementations.

See Also:
  - Serialized Form
NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

## Nested Class Summary

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

`SolrClient.SolrClientFunction<C extends SolrClient,R>`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected final String`
`basicAuthAuthorizationStr`
`protected static final String`
`DEFAULT_PATH`
`protected Set<String>`
`defaultParserMimeTypes`
`protected static final Charset`
`FALLBACK_CHARSET`
`protected ResponseParser`
`parser`
`protected final long`
`requestTimeoutMillis`
`protected RequestWriter`
`requestWriter`
`protected final String`
`serverBaseUrl`
The URL of the Solr server.
`protected final Set<String>`
`urlParamNames`

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

`defaultCollection`

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`HttpSolrClientBase(String serverBaseUrl, HttpSolrClientBuilderBase<?,?> builder)`

## Method Summary

Modifier and Type
Method
Description
`protected abstract String`
`allProcessorSupportedContentTypesCommaDelimited(Collection<String> processorSupportedContentTypes)`
`protected static String`
`basicAuthCredentialsToAuthorizationString(String user, String pass)`
`abstract HttpSolrClientBuilderBase<?,?>`
`builder()`
`protected ModifiableSolrParams`
`calculateQueryParams(Set<String> queryParamNames, ModifiableSolrParams wparams)`
`protected abstract LBSolrClient`
`createLBSolrClient()`
`String`
`getBaseURL()`
`ResponseParser`
`getParser()`
`protected String`
`getRequestUrl(SolrRequest<?> solrRequest, String collection)`
`RequestWriter`
`getRequestWriter()`
`Set<String>`
`getUrlParamNames()`
`protected ModifiableSolrParams`
`initializeSolrParams(SolrRequest<?> solrRequest, ResponseParser parserToUse)`
`protected abstract boolean`
`isFollowRedirects()`
`protected boolean`
`isMultipart(Collection<ContentStream> streams)`
`boolean`
`isV2ApiRequest(SolrRequest<?> request)`
`protected NamedList<Object>`
`processErrorsAndResponse(int httpStatus, String responseReason, String responseMethod, ResponseParser processor, InputStream is, String mimeType, String encoding, boolean isV2Api, String urlExceptionMessage)`
`protected abstract boolean`
`processorAcceptsMimeType(Collection<String> processorSupportedContentTypes, String mimeType)`
`CompletableFuture<NamedList<Object>>`
`requestAsync(SolrRequest<?> request)`
Execute an asynchronous request against a Solr server using the default collection.
`abstract CompletableFuture<NamedList<Object>>`
`requestAsync(SolrRequest<?> request, String collection)`
Execute an asynchronous request against a Solr server for a given collection.
`abstract NamedList<Object>`
`requestWithBaseUrl(String baseUrl, SolrRequest<?> solrRequest, String collection)`
Executes a SolrRequest using the provided URL to temporarily override any "base URL" currently used by this client
`protected ResponseParser`
`responseParser(SolrRequest<?> solrRequest)`
`protected void`
`setParser(ResponseParser parser)`
`protected abstract void`
`updateDefaultMimeTypeForParser()`
`protected void`
`validateGetRequest(SolrRequest<?> solrRequest)`
`protected boolean`
`wantStream(ResponseParser processor)`

### 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, 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, request, rollback, rollback`

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

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

### Methods inherited from interface java.io.Closeable

`close`

## Field Details

### DEFAULT_PATH

protected static final String DEFAULT_PATH

See Also:
  - Constant Field Values

### FALLBACK_CHARSET

protected static final Charset FALLBACK_CHARSET

### serverBaseUrl

protected final String serverBaseUrl
The URL of the Solr server.

### requestTimeoutMillis

protected final long requestTimeoutMillis

### urlParamNames

protected final Set<String> urlParamNames

### requestWriter

protected RequestWriter requestWriter

### parser

protected ResponseParser parser

### defaultParserMimeTypes

protected Set<String> defaultParserMimeTypes

### basicAuthAuthorizationStr

protected final String basicAuthAuthorizationStr

## Constructor Details

### HttpSolrClientBase

protected HttpSolrClientBase(String serverBaseUrl, HttpSolrClientBuilderBase<?,?> builder)

## Method Details

### builder

public abstract HttpSolrClientBuilderBase<?,?> builder()

### createLBSolrClient

protected abstract LBSolrClient createLBSolrClient()

NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

### getRequestUrl

protected String getRequestUrl(SolrRequest<?> solrRequest, String collection) throws MalformedURLException

Throws:
  `MalformedURLException`

### responseParser

protected ResponseParser responseParser(SolrRequest<?> solrRequest)

### getRequestWriter

public RequestWriter getRequestWriter()

### initializeSolrParams

protected ModifiableSolrParams initializeSolrParams(SolrRequest<?> solrRequest, ResponseParser parserToUse)

### isMultipart

protected boolean isMultipart(Collection<ContentStream> streams)

### calculateQueryParams

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

### validateGetRequest

protected void validateGetRequest(SolrRequest<?> solrRequest) throws IOException

Throws:
  `IOException`

### isFollowRedirects

protected abstract boolean isFollowRedirects()

### processErrorsAndResponse

protected NamedList<Object> processErrorsAndResponse(int httpStatus, String responseReason, String responseMethod, ResponseParser processor, InputStream is, String mimeType, String encoding, boolean isV2Api, String urlExceptionMessage) throws SolrServerException

Throws:
  `SolrServerException`

### wantStream

protected boolean wantStream(ResponseParser processor)

### processorAcceptsMimeType

protected abstract boolean processorAcceptsMimeType(Collection<String> processorSupportedContentTypes, String mimeType)

### allProcessorSupportedContentTypesCommaDelimited

protected abstract String allProcessorSupportedContentTypesCommaDelimited(Collection<String> processorSupportedContentTypes)

### basicAuthCredentialsToAuthorizationString

protected static String basicAuthCredentialsToAuthorizationString(String user, String pass)

### setParser

protected void setParser(ResponseParser parser)

### updateDefaultMimeTypeForParser

protected abstract void updateDefaultMimeTypeForParser()

### requestWithBaseUrl

public abstract NamedList<Object> requestWithBaseUrl(String baseUrl, SolrRequest<?> solrRequest, String collection) throws SolrServerException, IOException
Executes a SolrRequest using the provided URL to temporarily override any "base URL" currently used by this client

Parameters:
  `baseUrl` - a URL to a root Solr path (i.e. "/solr") that should be used for this request
  `solrRequest` - the SolrRequest to send
  `collection` - an optional collection or core name used to override the client's "default collection". May be 'null' for any requests that don't require a collection or wish to rely on the client's default
Throws:
  `SolrServerException`
  `IOException`
See Also:
  - `SolrRequest.processWithBaseUrl(HttpSolrClientBase, String, String)`

### requestAsync

public abstract CompletableFuture<NamedList<Object>> requestAsync(SolrRequest<?> request, String collection)
Execute an asynchronous request against a Solr server for a given collection.

Parameters:
  `request` - the request to execute
  `collection` - the collection to execute the request against
Returns:
  a `CompletableFuture` that tracks the progress of the async request. Supports cancelling requests via `CompletableFuture.cancel(boolean)`, adding callbacks/error handling using `CompletableFuture.whenComplete(BiConsumer)` and `CompletableFuture.exceptionally(Function)` methods, and other CompletableFuture functionality. Will complete exceptionally in case of either an `IOException` or `SolrServerException` during the request. Once completed, the CompletableFuture will contain a `NamedList` with the response from the server.

### requestAsync

public CompletableFuture<NamedList<Object>> requestAsync(SolrRequest<?> request)
Execute an asynchronous request against a Solr server using the default collection.

Parameters:
  `request` - the request to execute
Returns:
  a `CompletableFuture` see `requestAsync(SolrRequest, String)`.

### isV2ApiRequest

public boolean isV2ApiRequest(SolrRequest<?> request)

### getBaseURL

public String getBaseURL()

### getParser

public ResponseParser getParser()

### getUrlParamNames

public Set<String> getUrlParamNames()