java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
edu.ucsb.nceas.metacat.oaipmh.provider.server.OAIHandler
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class OAIHandler extends javax.servlet.http.HttpServlet
OAIHandler is the primary Servlet for OAICat.
Author:
Jeffrey A. Young, OCLC Online Computer Library Center
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected HashMap
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Peform the http GET action.
    void
    doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Perform a POST action.
    protected boolean
    filterRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Override to do any pre-qualification; return false if the response should be returned immediately, without further action.
     
     
    static String
    getResult(HashMap attributes, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Transformer serverTransformer, HashMap serverVerbs)
     
    static String
    Get the VERSION number
    static Writer
    getWriter(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Get a response Writer depending on acceptable encodings
    void
    init(javax.servlet.ServletConfig config)
    init is called one time when the Servlet is loaded.
    static boolean
    Boolean to determine whether the Data Provider code is executing in a Metacat application.
    protected boolean
    Should the server report itself down for maintenance? Override this method if you want to do this check another way.

    Methods inherited from class javax.servlet.http.HttpServlet

    doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service

    Methods inherited from class javax.servlet.GenericServlet

    destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • attributesMap

      protected HashMap attributesMap
  • Constructor Details

    • OAIHandler

      public OAIHandler()
  • Method Details

    • getVERSION

      public static String getVERSION()
      Get the VERSION number
    • isIntegratedWithMetacat

      public static boolean isIntegratedWithMetacat()
      Boolean to determine whether the Data Provider code is executing in a Metacat application. This is normally true, but the 'integratedWithMetacat' value can be set to false by a developer when testing the code outside of Metacat. This eliminates dependencies on Metacat property settings.
      Returns:
    • doGet

      public void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.ServletException
      Peform the http GET action. Note that POST is shunted to here as well. The verb widget is taken from the request and used to invoke an OAIVerb object of the corresponding kind to do the actual work of the verb.
      Overrides:
      doGet in class javax.servlet.http.HttpServlet
      Parameters:
      request - the servlet's request information
      response - the servlet's response information
      Throws:
      IOException - an I/O error occurred
      javax.servlet.ServletException
    • doPost

      public void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.ServletException
      Perform a POST action. Actually this gets shunted to GET.
      Overrides:
      doPost in class javax.servlet.http.HttpServlet
      Parameters:
      request - the servlet's request information
      response - the servlet's response information
      Throws:
      IOException - an I/O error occurred
      javax.servlet.ServletException
    • filterRequest

      protected boolean filterRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Override to do any pre-qualification; return false if the response should be returned immediately, without further action.
      Parameters:
      request -
      response -
      Returns:
      false=return immediately, true=continue
    • getAttributes

      public HashMap getAttributes(Properties properties) throws Throwable
      Throws:
      Throwable
    • getAttributes

      public HashMap getAttributes(String pathInfo)
    • getResult

      public static String getResult(HashMap attributes, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Transformer serverTransformer, HashMap serverVerbs) throws Throwable
      Throws:
      Throwable
    • getWriter

      public static Writer getWriter(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException
      Get a response Writer depending on acceptable encodings
      Parameters:
      request - the servlet's request information
      response - the servlet's response information
      Throws:
      IOException - an I/O error occurred
    • init

      public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException
      init is called one time when the Servlet is loaded. This is the place where one-time initialization is done. Specifically, we load the properties file for this application, and create the AbstractCatalog object for subsequent use.
      Specified by:
      init in interface javax.servlet.Servlet
      Overrides:
      init in class javax.servlet.GenericServlet
      Parameters:
      config - servlet configuration information
      Throws:
      javax.servlet.ServletException - there was a problem with initialization
    • isServiceUnavailable

      protected boolean isServiceUnavailable(Properties properties)
      Should the server report itself down for maintenance? Override this method if you want to do this check another way.
      Parameters:
      properties -
      Returns:
      true=service is unavailable, false=service is available