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 Classes
    Modifier and Type
    Class
    Description
    static class 
     

    Nested 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

    Fields
    Modifier and Type
    Field
    Description
    static final String
    System property to cap the maximum number of outstanding async HTTP requests.
    protected org.apache.solr.client.solrj.jetty.HttpJettySolrClient.AsyncTracker
     
    static final String
    A Java system property to select the SolrClientCustomizer used for configuring this client.
    static final String
     

    Fields inherited from class org.apache.solr.client.solrj.impl.HttpSolrClient

    baseUrl, basicAuthAuthorizationStr, DEFAULT_URL_PARAM_NAMES, FALLBACK_CHARSET, parser, requestTimeoutMillis, requestWriter, urlParamNames

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

    defaultCollection
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the number of currently available async-request permits.
    int
    Returns the configured maximum number of outstanding async requests.
    protected static String
     
    void
     
    protected org.apache.solr.client.solrj.impl.LBSolrClient
     
    protected void
    decorateRequest(org.eclipse.jetty.client.Request req, org.apache.solr.client.solrj.SolrRequest<?> solrRequest, boolean isAsync)
     
    org.eclipse.jetty.client.HttpClient
    internal use only
    long
    (visible for testing)
    protected org.apache.solr.common.params.ModifiableSolrParams
    initializeSolrParams(org.apache.solr.client.solrj.SolrRequest<?> solrRequest, org.apache.solr.client.solrj.response.ResponseParser parserToUse)
     
    protected boolean
     
    org.apache.solr.common.util.NamedList<Object>
    request(org.apache.solr.client.solrj.SolrRequest<?> solrRequest, String collection)
     
    CompletableFuture<org.apache.solr.common.util.NamedList<Object>>
    requestAsync(org.apache.solr.client.solrj.SolrRequest<?> solrRequest, String collection)
     
    <R> R
    requestWithBaseUrl(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 lambda
    org.apache.solr.common.util.NamedList<Object>
    requestWithBaseUrl(String baseUrl, org.apache.solr.client.solrj.SolrRequest<?> solrRequest, String collection)
     
    static void
     
    protected org.apache.solr.client.solrj.response.ResponseParser
    responseParser(org.apache.solr.client.solrj.SolrRequest<?> solrRequest)
     
    void
    setAuthenticationStore(org.eclipse.jetty.client.AuthenticationStore authenticationStore)
     
    static void
     
    protected org.apache.solr.client.solrj.impl.HttpSolrClient.BuilderBase<?,?>
    toBuilder(String baseUrl)
     

    Methods inherited from class org.apache.solr.client.solrj.impl.HttpSolrClient

    builder, calculateQueryParams, getBaseURL, getParser, getRequestUrl, getRequestWriter, getUrlParamNames, isMultipart, isV2ApiRequest, processErrorsAndResponse, requestAsync, setParser, validateGetRequest, wantStream

    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, rollback, rollback

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • CLIENT_CUSTOMIZER_SYSPROP

      public static final String CLIENT_CUSTOMIZER_SYSPROP
      A Java system property to select the SolrClientCustomizer used for configuring this client.
      See Also:
    • ASYNC_REQUESTS_MAX_SYSPROP

      public static final String ASYNC_REQUESTS_MAX_SYSPROP
      System property to cap the maximum number of outstanding async HTTP requests. Default 1000.
      See Also:
    • REQ_PRINCIPAL_KEY

      public static final String REQ_PRINCIPAL_KEY
      See Also:
    • asyncTracker

      protected org.apache.solr.client.solrj.jetty.HttpJettySolrClient.AsyncTracker asyncTracker
  • Constructor Details

  • 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:
      requestAsync in class org.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:
      request in class org.apache.solr.client.solrj.SolrClient
      Throws:
      org.apache.solr.client.solrj.SolrServerException
      IOException
    • 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:
      requestWithBaseUrl in class org.apache.solr.client.solrj.impl.HttpSolrClient
      Throws:
      org.apache.solr.client.solrj.SolrServerException
      IOException
    • requestWithBaseUrl

      public <R> R requestWithBaseUrl(String baseUrl, org.apache.solr.client.solrj.SolrClient.SolrClientFunction<HttpJettySolrClient,R> clientFunction) throws org.apache.solr.client.solrj.SolrServerException, IOException
      Temporarily 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' lambda
      clientFunction - a Function that consumes a HttpJettySolrClient and returns an arbitrary value
      Returns:
      the value returned after invoking 'clientFunction'
      Throws:
      org.apache.solr.client.solrj.SolrServerException
      IOException
    • createLBSolrClient

      protected org.apache.solr.client.solrj.impl.LBSolrClient createLBSolrClient()
      Specified by:
      createLBSolrClient in class org.apache.solr.client.solrj.impl.HttpSolrClient
    • toBuilder

      protected org.apache.solr.client.solrj.impl.HttpSolrClient.BuilderBase<?,?> toBuilder(String baseUrl)
      Specified by:
      toBuilder in class org.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:
      initializeSolrParams in class org.apache.solr.client.solrj.impl.HttpSolrClient
    • responseParser

      protected org.apache.solr.client.solrj.response.ResponseParser responseParser(org.apache.solr.client.solrj.SolrRequest<?> solrRequest)
      Overrides:
      responseParser in class org.apache.solr.client.solrj.impl.HttpSolrClient
    • basicAuthCredentialsToAuthorizationString

      protected static String basicAuthCredentialsToAuthorizationString(String user, String pass)
    • 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:
      isFollowRedirects in class org.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

      public static void setDefaultSSLConfig(SSLConfig sslConfig)
    • resetSslContextFactory

      public static void resetSslContextFactory()