Package org.apache.solr.servlet
Class HttpSolrCall
java.lang.Object
org.apache.solr.servlet.HttpSolrCall
- Direct Known Subclasses:
CoordinatorHttpSolrCall,V2HttpCall
This class represents a call made to Solr
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SolrDispatchFilter.Actionprotected SolrConfigprotected SolrCoreprotected final CoreContainerprotected Stringprotected SolrRequestHandlerstatic final Stringprotected Stringstatic final Stringprotected Stringprotected org.apache.solr.common.params.SolrParamsprotected final javax.servlet.http.HttpServletRequestprotected AuthorizationContext.RequestTypeprotected final javax.servlet.http.HttpServletResponseprotected final booleanprotected final SolrDispatchFilterprotected SolrQueryRequest -
Constructor Summary
ConstructorsConstructorDescriptionHttpSolrCall(SolrDispatchFilter solrDispatchFilter, CoreContainer cores, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, boolean retry) -
Method Summary
Modifier and TypeMethodDescriptionprotected Objectprotected voidaddCollectionParamIfNeeded(List<String> collections) Sets the "collection" parameter on the request to the list of alias-resolved collections for this request.protected voidautoCreateSystemColl(String corename) call()This method processes the request.protected voidprotected voidExtract handler from the URL path if not set.protected voidextractRemotePath(String collectionName, String origCorename) The collection(s) to authorize this request against.The collection(s) referenced in this request.List<org.apache.solr.common.util.CommandOperation> getCommands(boolean validateInput) getCore()protected SolrCoregetCoreByCollection(String collectionName, boolean isPreferLeader) Retrieves a SolrCore instance associated with the specified collection name, with an option to prefer leader replicas.protected StringgetPath()org.apache.solr.common.params.SolrParamsIf the request has been created, return its parameters (merges URL and body if applicable); otherwise, return only the URL query parameters.protected StringgetRemoteCoreUrl(String collectionName, String origCorename) javax.servlet.http.HttpServletRequestgetReq()protected QueryResponseWriterReturnsQueryResponseWriterto be used.protected io.opentracing.SpangetSpan()Get the span for this request.protected org.apache.solr.common.util.ValidatingJsonMapgetSpec()The URL to this core, e.g.Gets the client (user-agent) SolrJ version, or null if isn't SolrJ.protected voidhandleAdmin(SolrQueryResponse solrResp) protected voidHandle a request whose "type" could not be discerned in advance and may be either "admin" or "remotequery".protected voidinit()protected voidlogAndFlushAdminRequest(SolrQueryResponse solrResp) protected voidnormalizeAndSetPath(String unnormalizedPath) protected voidpopulateTracingSpan(io.opentracing.Span span) resolveCollectionListOrAlias(String collectionStr) Resolves the parameter as a potential comma delimited list of collections, and resolves aliases too.protected org.apache.solr.common.cloud.DocCollectionresolveDocCollection(String collectionName) Resolves the specified collection name to aDocCollectionobject.protected voidprotected voidprotected voidbooleanstatic booleanshouldAudit(CoreContainer cores) static booleanshouldAudit(CoreContainer cores, AuditEvent.EventType eventType) booleanshouldAudit(AuditEvent.EventType eventType) protected voidwriteResponse(SolrQueryResponse solrRsp, QueryResponseWriter responseWriter, Method reqMethod)
-
Field Details
-
ORIGINAL_USER_PRINCIPAL_HEADER
- See Also:
-
INTERNAL_REQUEST_COUNT
- See Also:
-
solrDispatchFilter
-
cores
-
req
protected final javax.servlet.http.HttpServletRequest req -
response
protected final javax.servlet.http.HttpServletResponse response -
retry
protected final boolean retry -
core
-
solrReq
-
handler
-
queryParams
protected org.apache.solr.common.params.SolrParams queryParams -
path
-
action
-
coreUrl
-
config
-
invalidStates
-
origCorename
-
collectionsList
-
requestType
-
-
Constructor Details
-
HttpSolrCall
public HttpSolrCall(SolrDispatchFilter solrDispatchFilter, CoreContainer cores, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, boolean retry)
-
-
Method Details
-
normalizeAndSetPath
-
getPath
-
getReq
public javax.servlet.http.HttpServletRequest getReq() -
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
The collection(s) referenced in this request. Populated ininit(). Not null. -
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 isgetCollectionsList(). Not null. -
init
- Throws:
Exception
-
resolveDocCollection
Resolves the specified collection name to aDocCollectionobject. If Solr is not in cloud mode, aSolrExceptionis thrown. Returns null if the collection name is null or empty. Retrieves theDocCollectionusing theZkStateReaderfromCoreContainer. If the collection is null, updates the state by refreshing aliases and forcing a collection update. -
autoCreateSystemColl
- Throws:
Exception
-
resolveCollectionListOrAlias
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
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.KeeperExceptionInterruptedExceptionorg.apache.solr.common.SolrException
-
sendRemoteQuery
- Throws:
IOException
-
call
This method processes the request.- Throws:
IOException
-
handleAdminOrRemoteRequest
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
-
shouldAudit
public boolean shouldAudit() -
shouldAudit
-
shouldAudit
-
shouldAudit
-
sendError
- Throws:
IOException
-
sendError
- Throws:
IOException
-
executeCoreRequest
-
logAndFlushAdminRequest
- Throws:
IOException
-
getResponseWriter
ReturnsQueryResponseWriterto be used. WhenCommonParams.WTnot specified in the request or specified value doesn't have correspondingQueryResponseWriterthen, returns the default query response writer Note: This method must not return null -
handleAdmin
-
addCollectionParamIfNeeded
Sets the "collection" parameter on the request to the list of alias-resolved collections for this request. It can be avoided sometimes. Note:HttpShardHandlerprocesses this param.- See Also:
-
writeResponse
protected void writeResponse(SolrQueryResponse solrRsp, QueryResponseWriter responseWriter, Method reqMethod) throws IOException - Throws:
IOException
-
getCoreByCollection
Retrieves a SolrCore instance associated with the specified collection name, with an option to prefer leader replicas. Makes a call toresolveDocCollection(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
-
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
-
getSpec
protected org.apache.solr.common.util.ValidatingJsonMap getSpec() -
getValidators
-
getThisNodeUrl
The URL to this core, e.g.http://localhost:8983/solr.- See Also:
-