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.HttpServlet
A Servlet implementation, which provides an environment for running aSRUServer
in a Servlet container. Your search engine must useSRUSearchEngineBase
as 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
SRUSearchEngineBase
is "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 String
SRU_SERVER_CONFIG_LOCATION_DEFAULT
Default value for the location of the SRU server configuration.static String
SRU_SERVER_CONFIG_LOCATION_PARAM
Servlet initialization parameter name for the location of the SRU server configuration.static String
SRU_SERVER_SEARCH_ENGINE_CLASS_PARAM
Servlet 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 void
destroy()
Destroy the SRU server Servlet.protected void
doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Handle a HTTP get request.protected void
doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Handle a HTTP post request.void
init()
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.ServletException
Initialize the SRU server Servlet.- Overrides:
init
in classjavax.servlet.GenericServlet
- Throws:
javax.servlet.ServletException
- See Also:
GenericServlet.init()
-
destroy
public void destroy()
Destroy the SRU server Servlet.- Specified by:
destroy
in interfacejavax.servlet.Servlet
- Overrides:
destroy
in 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, IOException
Handle a HTTP get request.- Overrides:
doGet
in classjavax.servlet.http.HttpServlet
- Throws:
javax.servlet.ServletException
IOException
- 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, IOException
Handle a HTTP post request.- Overrides:
doPost
in classjavax.servlet.http.HttpServlet
- Throws:
javax.servlet.ServletException
IOException
- See Also:
HttpServlet.doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
-
-