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, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, boolean retry)
  • Method Details

    • normalizeAndSetPath

      protected void normalizeAndSetPath(String unnormalizedPath)
    • getPath

      public String getPath()
    • getReq

      public javax.servlet.http.HttpServletRequest getReq()
    • getCore

      public SolrCore getCore()
    • getQueryParams

      public org.apache.solr.common.params.SolrParams getQueryParams()
      If the request has been created, return its parameters (merges URL and body if applicable); otherwise, return only the URL query parameters.
    • getCollectionsList

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

      public List<String> getAuthorizationCollectionsList()
      The collection(s) to authorize this request against. In SolrCloud, when a local core serves the request, this is the collection of that core, since that is where the request executes; requests it sends to other collections are authorized by the receiving nodes. Otherwise, this is getCollectionsList(). 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.
    • autoCreateSystemColl

      protected void autoCreateSystemColl(String corename) throws Exception
      Throws:
      Exception
    • 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, String origCorename) throws org.apache.zookeeper.KeeperException, InterruptedException, org.apache.solr.common.SolrException
      Throws:
      org.apache.zookeeper.KeeperException
      InterruptedException
      org.apache.solr.common.SolrException
    • sendRemoteQuery

      protected void sendRemoteQuery() throws IOException
      Throws:
      IOException
    • 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 "remotequery".

      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

      protected io.opentracing.Span getSpan()
      Get the span for this request. Not null.
    • populateTracingSpan

      protected void populateTracingSpan(io.opentracing.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)
    • 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, String origCorename) 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()
    • getThisNodeUrl

      public String getThisNodeUrl()
      The URL to this core, e.g. http://localhost:8983/solr.
      See Also: