Package eu.clarin.sru.server.utils
Class SRUServerServlet
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- eu.clarin.sru.server.utils.SRUServerServlet
-
- All Implemented Interfaces:
Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig
public final class SRUServerServlet extends javax.servlet.http.HttpServletA Servlet implementation, which provides an environment for running aSRUServerin a Servlet container. Your search engine must useSRUSearchEngineBaseas base class.Add the following to the web.xml of your web applications web.xml to define a SRU server. Of course, the value of the Servlet initialization parameter "eu.clarin.sru.server.utils.sruServerSearchEngineClass" must be adapted to match the name of your search engine implementation. Furthermore, you can choose different url-pattern, to match your needs.
For example, if your implementation of
SRUSearchEngineBaseis "com.acme.MySearchEngine" and you want to map the Servlet to the URI "/sru" the following snippet in your "web.xml" should accomplish the task:<servlet> <servlet-name>SRUServerServlet</servlet-name> <servlet-class>eu.clarin.sru.server.utils.SRUServerServlet</servlet-class> <init-param> <param-name>eu.clarin.sru.server.utils.sruServerSearchEngineClass</param-name> <param-value>com.acme.MySearchEngine</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>SRUServerServlet</servlet-name> <url-pattern>/sru</url-pattern> </servlet-mapping>- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringSRU_SERVER_CONFIG_LOCATION_DEFAULTDefault value for the location of the SRU server configuration.static StringSRU_SERVER_CONFIG_LOCATION_PARAMServlet initialization parameter name for the location of the SRU server configuration.static StringSRU_SERVER_SEARCH_ENGINE_CLASS_PARAMServlet initialization parameter name for the class that implements the SRU search engine.
-
Constructor Summary
Constructors Constructor Description SRUServerServlet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Destroy the SRU server Servlet.protected voiddoGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Handle a HTTP get request.protected voiddoPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Handle a HTTP post request.voidinit()Initialize the SRU server Servlet.-
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
-
-
-
-
Field Detail
-
SRU_SERVER_CONFIG_LOCATION_PARAM
public static final String SRU_SERVER_CONFIG_LOCATION_PARAM
Servlet initialization parameter name for the location of the SRU server configuration.- See Also:
- Constant Field Values
-
SRU_SERVER_SEARCH_ENGINE_CLASS_PARAM
public static final String SRU_SERVER_SEARCH_ENGINE_CLASS_PARAM
Servlet initialization parameter name for the class that implements the SRU search engine.- See Also:
- Constant Field Values
-
SRU_SERVER_CONFIG_LOCATION_DEFAULT
public static final String SRU_SERVER_CONFIG_LOCATION_DEFAULT
Default value for the location of the SRU server configuration.- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public void init() throws javax.servlet.ServletExceptionInitialize the SRU server Servlet.- Overrides:
initin classjavax.servlet.GenericServlet- Throws:
javax.servlet.ServletException- See Also:
GenericServlet.init()
-
destroy
public void destroy()
Destroy the SRU server Servlet.- Specified by:
destroyin interfacejavax.servlet.Servlet- Overrides:
destroyin classjavax.servlet.GenericServlet- See Also:
GenericServlet.destroy()
-
doGet
protected void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOExceptionHandle a HTTP get request.- Overrides:
doGetin classjavax.servlet.http.HttpServlet- Throws:
javax.servlet.ServletExceptionIOException- See Also:
HttpServlet.doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
-
doPost
protected void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOExceptionHandle a HTTP post request.- Overrides:
doPostin classjavax.servlet.http.HttpServlet- Throws:
javax.servlet.ServletExceptionIOException- See Also:
HttpServlet.doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
-
-