Package org.apache.solr.rest
Class BaseSolrResource
- java.lang.Object
-
- org.restlet.resource.Resource
-
- org.restlet.resource.ServerResource
-
- org.apache.solr.rest.BaseSolrResource
-
- Direct Known Subclasses:
RestManager.ManagedEndpoint
public abstract class BaseSolrResource extends org.restlet.resource.ServerResource
Base class of all Solr Restlet server resource classes.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
BaseSolrResource.SolrOutputRepresentation
This class serves as an adapter between Restlet and Solr's response writers.
-
Field Summary
Fields Modifier and Type Field Description protected static String
SHOW_DEFAULTS
static String
UPDATE_TIMEOUT_SECS
-
Constructor Summary
Constructors Modifier Constructor Description protected
BaseSolrResource()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addDeprecatedWarning()
void
doInit()
Pulls the SolrQueryRequest constructed in SolrDispatchFilter from the SolrRequestInfo thread local, then gets the SolrCore and IndexSchema and sets up the response.String
getContentType()
IndexSchema
getSchema()
SolrCore
getSolrCore()
SolrQueryRequest
getSolrRequest()
SolrQueryResponse
getSolrResponse()
protected int
getUpdateTimeoutSecs()
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.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.protected static String
urlDecode(String str)
Decode URL-encoded strings as UTF-8, and avoid converting "+" to space-
Methods inherited from class org.restlet.resource.ServerResource
abort, commit, delete, delete, describeVariants, doCatch, doConditionalHandle, doError, doHandle, doHandle, doNegotiatedHandle, get, get, getAttribute, getDescription, getInfo, getInfo, getName, getOnSent, getPreferredVariant, getRole, getVariants, getVariants, handle, hasAnnotations, head, head, isAnnotated, isAutoCommitting, isCommitted, isConditional, isExisting, isInRole, isNegotiated, options, options, patch, patch, post, post, put, put, redirectPermanent, redirectPermanent, redirectSeeOther, redirectSeeOther, redirectTemporary, redirectTemporary, setAllowedMethods, setAnnotated, setAttribute, setAutoCommitting, setChallengeRequests, setCommitted, setConditional, setCookieSettings, setDescription, setDimensions, setExisting, setLocationRef, setLocationRef, setName, setNegotiated, setOnSent, setProxyChallengeRequests, setServerInfo, setStatus, setStatus, setStatus, setStatus, updateAllowedMethods, updateDimensions
-
Methods inherited from class org.restlet.resource.Resource
doError, doRelease, getAllowedMethods, getApplication, getChallengeRequests, getChallengeResponse, getClientInfo, getConditions, getConnegService, getContext, getConverterService, getCookies, getCookieSettings, getDimensions, getHostRef, getLocationRef, getLogger, getMatrix, getMatrixValue, getMaxForwards, getMetadataService, getMethod, getOriginalRef, getProtocol, getProxyChallengeRequests, getProxyChallengeResponse, getQuery, getQueryValue, getRanges, getReference, getReferrerRef, getRequest, getRequestAttributes, getRequestCacheDirectives, getRequestEntity, getResponse, getResponseAttributes, getResponseCacheDirectives, getResponseEntity, getRootRef, getServerInfo, getStatus, getStatusService, init, isConfidential, isLoggable, release, setApplication, setQueryValue, setRequest, setResponse, toBoolean, toByte, toDouble, toFloat, toInteger, toLong, toObject, toRepresentation, toRepresentation, toRepresentation, toShort, toString
-
-
-
-
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() throws org.restlet.resource.ResourceException
Pulls the SolrQueryRequest constructed in SolrDispatchFilter from the SolrRequestInfo thread local, then gets the SolrCore and IndexSchema and sets up the response. writer.If an error occurs during initialization, setExisting(false) is called and an error status code and message is set; in this case, Restlet will not continue servicing the request (by calling the method annotated to associate it with GET, etc., but rather will send an error response.
- Overrides:
doInit
in classorg.restlet.resource.Resource
- Throws:
org.restlet.resource.ResourceException
-
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
-
-