Class HttpJettySolrClient

java.lang.Object
org.apache.solr.client.solrj.SolrClient
org.apache.solr.client.solrj.impl.HttpSolrClientBase
org.apache.solr.client.solrj.jetty.HttpJettySolrClient
All Implemented Interfaces:
Closeable, Serializable, AutoCloseable

public class HttpJettySolrClient extends org.apache.solr.client.solrj.impl.HttpSolrClientBase
An HTTP SolrClient using Jetty HttpClient. This is Solr's most mature client for direct HTTP.

Despite the name, this client supports HTTP 1.1 and 2 -- toggle with HttpSolrClientBuilderBase.useHttp1_1(boolean). In retrospect, the name should have been HttpJettySolrClient.

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.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
    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.HttpSolrClientBase

    basicAuthAuthorizationStr, DEFAULT_PATH, defaultParserMimeTypes, FALLBACK_CHARSET, parser, requestTimeoutMillis, requestWriter, serverBaseUrl, 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
    void
    Deprecated.
    protected String
     
    protected static String
     
    org.apache.solr.client.solrj.impl.HttpSolrClientBuilderBase<?,?>
     
    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
     
    protected boolean
    processorAcceptsMimeType(Collection<String> processorSupportedContentTypes, String mimeType)
     
    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 void
     

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

    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:
    • 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

    • addListenerFactory

      @Deprecated(since="9.7") public void addListenerFactory(HttpListenerFactory factory)
      Deprecated.
    • 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.HttpSolrClientBase
    • 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.HttpSolrClientBase
      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.HttpSolrClientBase
    • builder

      public org.apache.solr.client.solrj.impl.HttpSolrClientBuilderBase<?,?> builder()
      Specified by:
      builder in class org.apache.solr.client.solrj.impl.HttpSolrClientBase
    • 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.HttpSolrClientBase
    • 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.HttpSolrClientBase
    • 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.HttpSolrClientBase
    • processorAcceptsMimeType

      protected boolean processorAcceptsMimeType(Collection<String> processorSupportedContentTypes, String mimeType)
      Specified by:
      processorAcceptsMimeType in class org.apache.solr.client.solrj.impl.HttpSolrClientBase
    • updateDefaultMimeTypeForParser

      protected void updateDefaultMimeTypeForParser()
      Specified by:
      updateDefaultMimeTypeForParser in class org.apache.solr.client.solrj.impl.HttpSolrClientBase
    • allProcessorSupportedContentTypesCommaDelimited

      protected String allProcessorSupportedContentTypesCommaDelimited(Collection<String> processorSupportedContentTypes)
      Specified by:
      allProcessorSupportedContentTypesCommaDelimited in class org.apache.solr.client.solrj.impl.HttpSolrClientBase
    • setDefaultSSLConfig

      public static void setDefaultSSLConfig(SSLConfig sslConfig)
    • resetSslContextFactory

      public static void resetSslContextFactory()