edu.ucsb.nceas.metacat.oaipmh.provider.server

## Class OAIHandler

- java.lang.Object
- - javax.servlet.GenericServlet
  - - javax.servlet.http.HttpServlet
    - - edu.ucsb.nceas.metacat.oaipmh.provider.server.OAIHandler

- All Implemented Interfaces:
    java.io.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:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.HashMap` | `attributesMap`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `OAIHandler()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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.
    `java.util.HashMap` | `getAttributes(java.util.Properties properties)`
    `java.util.HashMap` | `getAttributes(java.lang.String pathInfo)`
    `static java.lang.String` | `getResult(java.util.HashMap attributes, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.xml.transform.Transformer serverTransformer, java.util.HashMap serverVerbs)`
    `static java.lang.String` | `getVERSION()` Get the VERSION number
    `static java.io.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` | `isIntegratedWithMetacat()` Boolean to determine whether the Data Provider code is executing in a Metacat application.
    `protected boolean` | `isServiceUnavailable(java.util.Properties properties)` 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 Detail

    - #### attributesMap

          protected java.util.HashMap attributesMap

  - ### Constructor Detail

    - #### OAIHandler

          public OAIHandler()

  - ### Method Detail

    - #### getVERSION

          public static java.lang.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 java.io.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:
        `java.io.IOException` - an I/O error occurred
        `javax.servlet.ServletException`

    - #### doPost

          public void doPost(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response)
                      throws java.io.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:
        `java.io.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 java.util.HashMap getAttributes(java.util.Properties properties)
                                          throws java.lang.Throwable

      Throws:
        `java.lang.Throwable`

    - #### getAttributes

          public java.util.HashMap getAttributes(java.lang.String pathInfo)

    - #### getResult

          public static java.lang.String getResult(java.util.HashMap attributes,
                                                   javax.servlet.http.HttpServletRequest request,
                                                   javax.servlet.http.HttpServletResponse response,
                                                   javax.xml.transform.Transformer serverTransformer,
                                                   java.util.HashMap serverVerbs)
                                            throws java.lang.Throwable

      Throws:
        `java.lang.Throwable`

    - #### getWriter

          public static java.io.Writer getWriter(javax.servlet.http.HttpServletRequest request,
                                                 javax.servlet.http.HttpServletResponse response)
                                          throws java.io.IOException

      Get a response Writer depending on acceptable encodings
      Parameters:
        `request` - the servlet's request information
        `response` - the servlet's response information
      Throws:
        `java.io.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(java.util.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

Copyright © 2020 Regents of the University of California. All Rights Reserved.