Package org.apache.solr.rest
Class BaseSolrResource
- java.lang.Object
-
- org.apache.solr.rest.BaseSolrResource
-
- Direct Known Subclasses:
RestManager.ManagedEndpoint
public abstract class BaseSolrResource extends Object
Base class for delegating REST-oriented requests to ManagedResources. ManagedResources are heavy-weight and should not be created for every request, so this class serves as a gateway between a REST call and the resource.
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringSHOW_DEFAULTSstatic StringUPDATE_TIMEOUT_SECS
-
Constructor Summary
Constructors Modifier Constructor Description protectedBaseSolrResource()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddDeprecatedWarning()voiddoInit(SolrQueryRequest solrRequest, SolrQueryResponse solrResponse)Pulls the SolrQueryRequest constructed in SolrDispatchFilter from the SolrRequestInfo thread local, then gets the SolrCore and IndexSchema and sets up the response.StringgetContentType()IndexSchemagetSchema()SolrCoregetSolrCore()SolrQueryRequestgetSolrRequest()SolrQueryResponsegetSolrResponse()protected intgetUpdateTimeoutSecs()protected voidhandleException(org.slf4j.Logger log)If there is an exception on the SolrResponse: error info is added to the SolrResponse; the response status code is set to the error code from the exception; and the exception message is added to the list of things to be logged.protected voidhandlePostExecution(org.slf4j.Logger log)Deal with an exception on the SolrResponse, fill in response header info, and log the accumulated messages on the SolrResponse.protected static StringurlDecode(String str)Decode URL-encoded strings as UTF-8, and avoid converting "+" to space
-
-
-
Field Detail
-
SHOW_DEFAULTS
protected static final String SHOW_DEFAULTS
- See Also:
- Constant Field Values
-
UPDATE_TIMEOUT_SECS
public static final String UPDATE_TIMEOUT_SECS
- See Also:
- Constant Field Values
-
-
Method Detail
-
getSolrCore
public SolrCore getSolrCore()
-
getSchema
public IndexSchema getSchema()
-
getSolrRequest
public SolrQueryRequest getSolrRequest()
-
getSolrResponse
public SolrQueryResponse getSolrResponse()
-
getContentType
public String getContentType()
-
getUpdateTimeoutSecs
protected int getUpdateTimeoutSecs()
-
doInit
public void doInit(SolrQueryRequest solrRequest, SolrQueryResponse solrResponse)
Pulls the SolrQueryRequest constructed in SolrDispatchFilter from the SolrRequestInfo thread local, then gets the SolrCore and IndexSchema and sets up the response. writer.
-
handlePostExecution
protected void handlePostExecution(org.slf4j.Logger log)
Deal with an exception on the SolrResponse, fill in response header info, and log the accumulated messages on the SolrResponse.
-
addDeprecatedWarning
protected void addDeprecatedWarning()
-
handleException
protected void handleException(org.slf4j.Logger log)
If there is an exception on the SolrResponse:- error info is added to the SolrResponse;
- the response status code is set to the error code from the exception; and
- the exception message is added to the list of things to be logged.
-
urlDecode
protected static String urlDecode(String str) throws UnsupportedEncodingException
Decode URL-encoded strings as UTF-8, and avoid converting "+" to space- Throws:
UnsupportedEncodingException
-
-