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
Utility/base functionality for direct HTTP client implementations.
- See Also:
- 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
FieldsModifier and TypeFieldDescriptionprotected final Stringprotected static final Stringprotected static final Charsetprotected ResponseParserprotected final longprotected RequestWriterprotected final StringThe URL of the Solr server.Fields inherited from class org.apache.solr.client.solrj.SolrClient
defaultCollection -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedHttpSolrClientBase(String serverBaseUrl, HttpSolrClientBuilderBase<?, ?> builder) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract StringallProcessorSupportedContentTypesCommaDelimited(Collection<String> processorSupportedContentTypes) protected static StringbasicAuthCredentialsToAuthorizationString(String user, String pass) abstract HttpSolrClientBuilderBase<?, ?> builder()protected ModifiableSolrParamscalculateQueryParams(Set<String> queryParamNames, ModifiableSolrParams wparams) protected abstract LBSolrClientprotected StringgetRequestUrl(SolrRequest<?> solrRequest, String collection) protected ModifiableSolrParamsinitializeSolrParams(SolrRequest<?> solrRequest, ResponseParser parserToUse) protected abstract booleanprotected booleanisMultipart(Collection<ContentStream> streams) booleanisV2ApiRequest(SolrRequest<?> request) processErrorsAndResponse(int httpStatus, String responseReason, String responseMethod, ResponseParser processor, InputStream is, String mimeType, String encoding, boolean isV2Api, String urlExceptionMessage) protected abstract booleanprocessorAcceptsMimeType(Collection<String> processorSupportedContentTypes, String mimeType) 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.requestWithBaseUrl(String baseUrl, SolrRequest<?> solrRequest, String collection) Executes a SolrRequest using the provided URL to temporarily override any "base URL" currently used by this clientprotected ResponseParserresponseParser(SolrRequest<?> solrRequest) protected voidsetParser(ResponseParser parser) protected abstract voidprotected voidvalidateGetRequest(SolrRequest<?> solrRequest) protected booleanwantStream(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
-
Field Details
-
DEFAULT_PATH
- See Also:
-
FALLBACK_CHARSET
-
serverBaseUrl
The URL of the Solr server. -
requestTimeoutMillis
protected final long requestTimeoutMillis -
urlParamNames
-
requestWriter
-
parser
-
defaultParserMimeTypes
-
basicAuthAuthorizationStr
-
-
Constructor Details
-
HttpSolrClientBase
-
-
Method Details
-
builder
-
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
-
getRequestWriter
-
initializeSolrParams
protected ModifiableSolrParams initializeSolrParams(SolrRequest<?> solrRequest, ResponseParser parserToUse) -
isMultipart
-
calculateQueryParams
protected ModifiableSolrParams calculateQueryParams(Set<String> queryParamNames, ModifiableSolrParams wparams) -
validateGetRequest
- 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
-
processorAcceptsMimeType
protected abstract boolean processorAcceptsMimeType(Collection<String> processorSupportedContentTypes, String mimeType) -
allProcessorSupportedContentTypesCommaDelimited
protected abstract String allProcessorSupportedContentTypesCommaDelimited(Collection<String> processorSupportedContentTypes) -
basicAuthCredentialsToAuthorizationString
-
setParser
-
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 requestsolrRequest- the SolrRequest to sendcollection- 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:
SolrServerExceptionIOException- See Also:
-
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 executecollection- the collection to execute the request against- Returns:
- a
CompletableFuturethat tracks the progress of the async request. Supports cancelling requests viaCompletableFuture.cancel(boolean), adding callbacks/error handling usingCompletableFuture.whenComplete(BiConsumer)andCompletableFuture.exceptionally(Function)methods, and other CompletableFuture functionality. Will complete exceptionally in case of either anIOExceptionorSolrServerExceptionduring the request. Once completed, the CompletableFuture will contain aNamedListwith the response from the server.
-
requestAsync
Execute an asynchronous request against a Solr server using the default collection.- Parameters:
request- the request to execute- Returns:
- a
CompletableFutureseerequestAsync(SolrRequest, String).
-
isV2ApiRequest
-
getBaseURL
-
getParser
-
getUrlParamNames
-