@Bindable public abstract class RemoteXmlSimpleSearchEngineBase extends SimpleSearchEngine
| Modifier and Type | Field and Description |
|---|---|
HttpRedirectStrategy |
redirectStrategy
HTTP redirect response strategy (follow or throw an error).
|
compressed, documents, POSTPROCESSING, query, results, resultsTotal, SERVICE, start, statistics| Constructor and Description |
|---|
RemoteXmlSimpleSearchEngineBase() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
afterFetch(SearchEngineResponse response,
ProcessingResult processingResult)
Invoked after the response has been partially parsed and
ProcessingResult
deserialized. |
void |
beforeProcessing()
Invoked after the attributes marked with
Processing and Input
annotations have been bound, but before a call to IProcessingComponent.process(). |
protected abstract String |
buildServiceUrl()
Builds the URL from which XML stream will be fetched.
|
protected SearchEngineResponse |
fetchSearchResponse()
Requests and returns results from the underlying search engine.
|
protected String |
getPassword()
Returns the password to use for HTTP Basic Authentication.
|
protected String |
getUser()
Returns the user name to use for HTTP Basic Authentication.
|
protected Map<String,String> |
getXsltParameters()
Returns parameters to be passed to the XSLT transformer.
|
protected abstract IResource |
getXsltResource()
Returns the XSLT stylesheet that transforms the custom XML into Carrot2 compliant
XML.
|
void |
init(IControllerContext context)
Invoked after component's attributes marked with
Init and Input
annotations have been bound, but before calls to any other methods of this
component. |
protected ProcessingResult |
loadProcessingResult(String url,
Templates stylesheet,
Map<String,String> xsltParameters,
Map<String,Object> metadata,
String user,
String password,
HttpRedirectStrategy redirectStrategy)
Loads a
ProcessingResult from the provided remote URL, applying XSLT
transform if specified. |
processafterFetch, clean, urlEncodeafterProcessing, dispose, getContext, getSharedExecutorclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitafterProcessing, dispose@Input @Processing @Attribute @Label(value="HTTP redirect strategy") @Level(value=MEDIUM) @Group(value="Service") @Internal public HttpRedirectStrategy redirectStrategy
public void init(IControllerContext context)
IProcessingComponentInit and Input
annotations have been bound, but before calls to any other methods of this
component. After a call to this method completes without an exception, attributes
marked with Init Output will be collected. In this method,
components should perform initializations based on the initialization-time
attributes. This method is called once in the life time of a processing
component instance.init in interface IProcessingComponentinit in class ProcessingComponentBasecontext - An instance of IControllerContext of the controller to which this
component instance will be bound.public void beforeProcessing()
throws ProcessingException
IProcessingComponentProcessing and Input
annotations have been bound, but before a call to IProcessingComponent.process(). In this
method, the processing component should perform any initializations based on the
runtime attributes. This method is called once per request.beforeProcessing in interface IProcessingComponentbeforeProcessing in class ProcessingComponentBaseProcessingException - when processing cannot start, e.g. because some
attributes were not bound. If thrown, the IProcessingComponent.process() method
will not be called. Instead, IProcessingComponent.afterProcessing() will be called
immediately to allow clean-up actions, and the component will be ready
to accept further requests or to be disposed of. Finally, the exception
will be rethrown from the controller method that caused the component
to perform processing.protected SearchEngineResponse fetchSearchResponse() throws Exception
SimpleSearchEnginefetchSearchResponse in class SimpleSearchEngineException - in case of problems with the underlying search engineprotected void afterFetch(SearchEngineResponse response, ProcessingResult processingResult)
ProcessingResult
deserialized.protected abstract IResource getXsltResource()
protected Map<String,String> getXsltParameters()
null.protected abstract String buildServiceUrl()
protected String getUser()
protected String getPassword()
protected ProcessingResult loadProcessingResult(String url, Templates stylesheet, Map<String,String> xsltParameters, Map<String,Object> metadata, String user, String password, HttpRedirectStrategy redirectStrategy) throws Exception
ProcessingResult from the provided remote URL, applying XSLT
transform if specified. This method can handle gzip-compressed streams if supported
by the data source.metadata - if a non-null map is provided, request metadata will
be put into the map.user - if not null, the user name to use for HTTP Basic
Authenticationpassword - if not null, the password to use for HTTP Basic
AuthenticationException