Class HttpSolrCall

java.lang.Object
org.apache.solr.servlet.HttpSolrCall
Direct Known Subclasses:
CoordinatorHttpSolrCall, V2HttpCall

@ThreadSafe public class HttpSolrCall extends Object
This class represents a call made to Solr
  • Field Details

  • Constructor Details

    • HttpSolrCall

      public HttpSolrCall(SolrDispatchFilter solrDispatchFilter, CoreContainer cores, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, boolean retry)
  • Method Details

    • normalizeAndSetPath

      protected void normalizeAndSetPath(String unnormalizedPath)
    • getPath

      public String getPath()
    • getReq

      public jakarta.servlet.http.HttpServletRequest getReq()
      WARNING: This method returns a non-null HttpServletRequest, but calling certain methods on it — such as ServletRequest.getAttribute(String) — may throw NullPointerException if accessed outside the original servlet thread (e.g., in asynchronous tasks).

      Always cache required request data early during request handling if it needs to be accessed later.

    • getCore

      public SolrCore getCore()
    • getQueryParams

      public org.apache.solr.common.params.SolrParams getQueryParams()
    • getCollectionsList

      public List<String> getCollectionsList()
      The collection(s) referenced in this request. Populated in init(). Not null.
    • init

      protected void init() throws Exception
      Throws:
      Exception
    • resolveDocCollection

      protected org.apache.solr.common.cloud.DocCollection resolveDocCollection(String collectionName)
      Resolves the specified collection name to a DocCollection object. If Solr is not in cloud mode, a SolrException is thrown. Returns null if the collection name is null or empty. Retrieves the DocCollection using the ZkStateReader from CoreContainer. If the collection is null, updates the state by refreshing aliases and forcing a collection update.
    • resolveCollectionListOrAlias

      protected List<String> resolveCollectionListOrAlias(String collectionStr)
      Resolves the parameter as a potential comma delimited list of collections, and resolves aliases too. One level of aliases pointing to another alias is supported. De-duplicates and retains the order. getCollectionsList()
    • extractHandlerFromURLPath

      protected void extractHandlerFromURLPath(SolrRequestParsers parser) throws Exception
      Extract handler from the URL path if not set.
      Throws:
      Exception
    • extractRemotePath

      protected void extractRemotePath(String collectionName) throws org.apache.zookeeper.KeeperException, InterruptedException, org.apache.solr.common.SolrException
      Throws:
      org.apache.zookeeper.KeeperException
      InterruptedException
      org.apache.solr.common.SolrException
    • call

      public SolrDispatchFilter.Action call() throws IOException
      This method processes the request.
      Throws:
      IOException
    • handleAdminOrRemoteRequest

      protected void handleAdminOrRemoteRequest() throws IOException
      Handle a request whose "type" could not be discerned in advance and may be either "admin" or "remoteproxy".

      Some implementations (such as V2HttpCall) may find it difficult to differentiate all request types in advance. This method serves as a hook; allowing those implementations to handle these cases gracefully.

      Throws:
      IOException
      See Also:
    • getSpan

      public io.opentelemetry.api.trace.Span getSpan()
      Get the Span for this request. Not null.
    • populateTracingSpan

      protected void populateTracingSpan(io.opentelemetry.api.trace.Span span)
    • getCoreOrColName

      protected String getCoreOrColName()
    • shouldAudit

      public boolean shouldAudit()
    • shouldAudit

      public boolean shouldAudit(AuditEvent.EventType eventType)
    • shouldAudit

      public static boolean shouldAudit(CoreContainer cores)
    • shouldAudit

      public static boolean shouldAudit(CoreContainer cores, AuditEvent.EventType eventType)
    • sendRemoteProxy

      protected void sendRemoteProxy() throws IOException
      Throws:
      IOException
    • sendError

      protected void sendError(Throwable ex) throws IOException
      Throws:
      IOException
    • sendError

      protected void sendError(int code, String message) throws IOException
      Throws:
      IOException
    • executeCoreRequest

      protected void executeCoreRequest(SolrQueryResponse rsp)
    • logAndFlushAdminRequest

      protected void logAndFlushAdminRequest(SolrQueryResponse solrResp) throws IOException
      Throws:
      IOException
    • getResponseWriter

      protected QueryResponseWriter getResponseWriter()
      Returns QueryResponseWriter to be used. When CommonParams.WT not specified in the request or specified value doesn't have corresponding QueryResponseWriter then, returns the default query response writer Note: This method must not return null
    • handleAdmin

      protected void handleAdmin(SolrQueryResponse solrResp)
    • addCollectionParamIfNeeded

      protected void addCollectionParamIfNeeded(List<String> collections)
      Sets the "collection" parameter on the request to the list of alias-resolved collections for this request. It can be avoided sometimes. Note: HttpShardHandler processes this param.
      See Also:
    • writeResponse

      protected void writeResponse(SolrQueryResponse solrRsp, QueryResponseWriter responseWriter, Method reqMethod) throws IOException
      Throws:
      IOException
    • getCoreByCollection

      protected SolrCore getCoreByCollection(String collectionName, boolean isPreferLeader)
      Retrieves a SolrCore instance associated with the specified collection name, with an option to prefer leader replicas. Makes a call to resolveDocCollection(java.lang.String) which make an attempt to force update collection if it is not found in local cluster state
    • getRemoteCoreUrl

      protected String getRemoteCoreUrl(String collectionName) throws org.apache.solr.common.SolrException
      Throws:
      org.apache.solr.common.SolrException
    • _getHandler

      protected Object _getHandler()
    • getUserAgentSolrVersion

      public SolrVersion getUserAgentSolrVersion()
      Gets the client (user-agent) SolrJ version, or null if isn't SolrJ. Note that older SolrJ clients prior to 9.9 present themselves as 1.0 or 2.0.
    • getCommands

      public List<org.apache.solr.common.util.CommandOperation> getCommands(boolean validateInput)
    • getSpec

      protected org.apache.solr.common.util.ValidatingJsonMap getSpec()
    • getValidators

      protected Map<String,org.apache.solr.common.util.JsonSchemaValidator> getValidators()