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:
Http2SolrClient,HttpJdkSolrClient
public abstract class HttpSolrClientBase extends SolrClient
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected StringbasicAuthAuthorizationStrprotected static StringDEFAULT_PATHprotected Set<String>defaultParserMimeTypesprotected static CharsetFALLBACK_CHARSETprotected ResponseParserparserprotected longrequestTimeoutMillisprotected RequestWriterrequestWriterprotected StringserverBaseUrlThe URL of the Solr server.protected Set<String>urlParamNames-
Fields inherited from class org.apache.solr.client.solrj.SolrClient
defaultCollection
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedHttpSolrClientBase(String serverBaseUrl, HttpSolrClientBuilderBase<?,?> builder)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected abstract StringallProcessorSupportedContentTypesCommaDelimited(Collection<String> processorSupportedContentTypes)abstract CancellableasyncRequest(SolrRequest<?> solrRequest, String collection, AsyncListener<NamedList<Object>> asyncListener)Deprecated.protected static StringbasicAuthCredentialsToAuthorizationString(String user, String pass)protected ModifiableSolrParamscalculateQueryParams(Set<String> queryParamNames, ModifiableSolrParams wparams)StringgetBaseURL()ResponseParsergetParser()protected StringgetRequestUrl(SolrRequest<?> solrRequest, String collection)Set<String>getUrlParamNames()protected ModifiableSolrParamsinitalizeSolrParams(SolrRequest<?> solrRequest, ResponseParser parserToUse)Deprecated, for removal: This API element is subject to removal in a future version.protected ModifiableSolrParamsinitializeSolrParams(SolrRequest<?> solrRequest, ResponseParser parserToUse)protected abstract booleanisFollowRedirects()protected booleanisMultipart(Collection<ContentStream> streams)booleanisV2ApiRequest(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 booleanprocessorAcceptsMimeType(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.protected ResponseParserresponseParser(SolrRequest<?> solrRequest)protected voidsetParser(ResponseParser parser)protected abstract voidupdateDefaultMimeTypeForParser()protected 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, 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, request, rollback, rollback
-
-
-
-
Field Detail
-
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
-
requestWriter
protected RequestWriter requestWriter
-
parser
protected ResponseParser parser
-
basicAuthAuthorizationStr
protected final String basicAuthAuthorizationStr
-
-
Constructor Detail
-
HttpSolrClientBase
protected HttpSolrClientBase(String serverBaseUrl, HttpSolrClientBuilderBase<?,?> builder)
-
-
Method Detail
-
getRequestUrl
protected String getRequestUrl(SolrRequest<?> solrRequest, String collection) throws MalformedURLException
- Throws:
MalformedURLException
-
responseParser
protected ResponseParser responseParser(SolrRequest<?> solrRequest)
-
initalizeSolrParams
@Deprecated(since="9.8", forRemoval=true) protected ModifiableSolrParams initalizeSolrParams(SolrRequest<?> solrRequest, ResponseParser parserToUse)
Deprecated, for removal: This API element is subject to removal in a future version.
-
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()
-
asyncRequest
@Deprecated public abstract Cancellable asyncRequest(SolrRequest<?> solrRequest, String collection, AsyncListener<NamedList<Object>> asyncListener)
Deprecated.- Parameters:
solrRequest- the request to performcollection- if null the default collection is usedasyncListener- callers should provide an implementation to handle events: start, success, exception- Returns:
- Cancellable allowing the caller to attempt cancellation
-
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
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
CompletableFutureseerequestAsync(SolrRequest, String).
-
isV2ApiRequest
public boolean isV2ApiRequest(SolrRequest<?> request)
-
getBaseURL
public String getBaseURL()
-
getParser
public ResponseParser getParser()
-
-