Class HttpJettySolrClient
java.lang.Object
org.apache.solr.client.solrj.SolrClient
org.apache.solr.client.solrj.impl.HttpSolrClient
org.apache.solr.client.solrj.jetty.HttpJettySolrClient
- All Implemented Interfaces:
Closeable,Serializable,AutoCloseable
public class HttpJettySolrClient
extends org.apache.solr.client.solrj.impl.HttpSolrClient
An HTTP
SolrClient using Jetty HttpClient. This is Solr's most mature client for
direct HTTP.- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.apache.solr.client.solrj.impl.HttpSolrClient
org.apache.solr.client.solrj.impl.HttpSolrClient.BuilderBase<B extends org.apache.solr.client.solrj.impl.HttpSolrClient.BuilderBase<?,?>, C extends org.apache.solr.client.solrj.impl.HttpSolrClient> Nested classes/interfaces inherited from class org.apache.solr.client.solrj.SolrClient
org.apache.solr.client.solrj.SolrClient.SolrClientFunction<C extends org.apache.solr.client.solrj.SolrClient,R> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringSystem property to cap the maximum number of outstanding async HTTP requests.protected org.apache.solr.client.solrj.jetty.HttpJettySolrClient.AsyncTrackerstatic final StringA Java system property to select the SolrClientCustomizer used for configuring this client.static final StringFields inherited from class org.apache.solr.client.solrj.impl.HttpSolrClient
baseUrl, basicAuthAuthorizationStr, DEFAULT_URL_PARAM_NAMES, FALLBACK_CHARSET, parser, requestTimeoutMillis, requestWriter, urlParamNamesFields inherited from class org.apache.solr.client.solrj.SolrClient
defaultCollection -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedHttpJettySolrClient(String serverBaseUrl, HttpJettySolrClient.Builder builder) -
Method Summary
Modifier and TypeMethodDescriptionintReturns the number of currently available async-request permits.intReturns the configured maximum number of outstanding async requests.protected static StringbasicAuthCredentialsToAuthorizationString(String user, String pass) voidclose()protected org.apache.solr.client.solrj.impl.LBSolrClientprotected voiddecorateRequest(org.eclipse.jetty.client.Request req, org.apache.solr.client.solrj.SolrRequest<?> solrRequest, boolean isAsync) org.eclipse.jetty.client.HttpClientinternal use onlylong(visible for testing)protected org.apache.solr.common.params.ModifiableSolrParamsinitializeSolrParams(org.apache.solr.client.solrj.SolrRequest<?> solrRequest, org.apache.solr.client.solrj.response.ResponseParser parserToUse) protected booleanorg.apache.solr.common.util.NamedList<Object> CompletableFuture<org.apache.solr.common.util.NamedList<Object>> requestAsync(org.apache.solr.client.solrj.SolrRequest<?> solrRequest, String collection) <R> RrequestWithBaseUrl(String baseUrl, org.apache.solr.client.solrj.SolrClient.SolrClientFunction<HttpJettySolrClient, R> clientFunction) Temporarily modifies the client to use a different base URL and runs the provided lambdaorg.apache.solr.common.util.NamedList<Object> requestWithBaseUrl(String baseUrl, org.apache.solr.client.solrj.SolrRequest<?> solrRequest, String collection) static voidprotected org.apache.solr.client.solrj.response.ResponseParserresponseParser(org.apache.solr.client.solrj.SolrRequest<?> solrRequest) voidsetAuthenticationStore(org.eclipse.jetty.client.AuthenticationStore authenticationStore) static voidsetDefaultSSLConfig(SSLConfig sslConfig) protected org.apache.solr.client.solrj.impl.HttpSolrClient.BuilderBase<?, ?> Methods inherited from class org.apache.solr.client.solrj.impl.HttpSolrClient
builder, calculateQueryParams, getBaseURL, getParser, getRequestUrl, getRequestWriter, getUrlParamNames, isMultipart, isV2ApiRequest, processErrorsAndResponse, requestAsync, setParser, validateGetRequest, wantStreamMethods 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, rollback, rollback
-
Field Details
-
CLIENT_CUSTOMIZER_SYSPROP
A Java system property to select the SolrClientCustomizer used for configuring this client.- See Also:
-
ASYNC_REQUESTS_MAX_SYSPROP
System property to cap the maximum number of outstanding async HTTP requests. Default 1000.- See Also:
-
REQ_PRINCIPAL_KEY
- See Also:
-
asyncTracker
protected org.apache.solr.client.solrj.jetty.HttpJettySolrClient.AsyncTracker asyncTracker
-
-
Constructor Details
-
HttpJettySolrClient
-
-
Method Details
-
getHttpClient
public org.eclipse.jetty.client.HttpClient getHttpClient()internal use only -
close
public void close() -
setAuthenticationStore
public void setAuthenticationStore(org.eclipse.jetty.client.AuthenticationStore authenticationStore) -
getIdleTimeoutMillis
public long getIdleTimeoutMillis()(visible for testing) -
requestAsync
public CompletableFuture<org.apache.solr.common.util.NamedList<Object>> requestAsync(org.apache.solr.client.solrj.SolrRequest<?> solrRequest, String collection) - Specified by:
requestAsyncin classorg.apache.solr.client.solrj.impl.HttpSolrClient
-
request
public org.apache.solr.common.util.NamedList<Object> request(org.apache.solr.client.solrj.SolrRequest<?> solrRequest, String collection) throws org.apache.solr.client.solrj.SolrServerException, IOException - Specified by:
requestin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
requestWithBaseUrl
public org.apache.solr.common.util.NamedList<Object> requestWithBaseUrl(String baseUrl, org.apache.solr.client.solrj.SolrRequest<?> solrRequest, String collection) throws org.apache.solr.client.solrj.SolrServerException, IOException - Specified by:
requestWithBaseUrlin classorg.apache.solr.client.solrj.impl.HttpSolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
requestWithBaseUrl
public <R> R requestWithBaseUrl(String baseUrl, org.apache.solr.client.solrj.SolrClient.SolrClientFunction<HttpJettySolrClient, R> clientFunction) throws org.apache.solr.client.solrj.SolrServerException, IOExceptionTemporarily modifies the client to use a different base URL and runs the provided lambda- Type Parameters:
R- the type returned by the provided function (and by this method)- Parameters:
baseUrl- the base URL to use on any requests made within the 'clientFunction' lambdaclientFunction- a Function that consumes a HttpJettySolrClient and returns an arbitrary value- Returns:
- the value returned after invoking 'clientFunction'
- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
createLBSolrClient
protected org.apache.solr.client.solrj.impl.LBSolrClient createLBSolrClient()- Specified by:
createLBSolrClientin classorg.apache.solr.client.solrj.impl.HttpSolrClient
-
toBuilder
protected org.apache.solr.client.solrj.impl.HttpSolrClient.BuilderBase<?,?> toBuilder(String baseUrl) - Specified by:
toBuilderin classorg.apache.solr.client.solrj.impl.HttpSolrClient
-
initializeSolrParams
protected org.apache.solr.common.params.ModifiableSolrParams initializeSolrParams(org.apache.solr.client.solrj.SolrRequest<?> solrRequest, org.apache.solr.client.solrj.response.ResponseParser parserToUse) - Overrides:
initializeSolrParamsin classorg.apache.solr.client.solrj.impl.HttpSolrClient
-
responseParser
protected org.apache.solr.client.solrj.response.ResponseParser responseParser(org.apache.solr.client.solrj.SolrRequest<?> solrRequest) - Overrides:
responseParserin classorg.apache.solr.client.solrj.impl.HttpSolrClient
-
basicAuthCredentialsToAuthorizationString
-
decorateRequest
protected void decorateRequest(org.eclipse.jetty.client.Request req, org.apache.solr.client.solrj.SolrRequest<?> solrRequest, boolean isAsync) -
isFollowRedirects
protected boolean isFollowRedirects()- Specified by:
isFollowRedirectsin classorg.apache.solr.client.solrj.impl.HttpSolrClient
-
asyncTrackerMaxPermits
public int asyncTrackerMaxPermits()Returns the configured maximum number of outstanding async requests. -
asyncTrackerAvailablePermits
public int asyncTrackerAvailablePermits()Returns the number of currently available async-request permits. -
setDefaultSSLConfig
-
resetSslContextFactory
public static void resetSslContextFactory()
-