edu.ucsb.nceas.metacat.restservice

## Class D1RestServlet

- java.lang.Object
- - javax.servlet.GenericServlet
  - - javax.servlet.http.HttpServlet
    - - edu.ucsb.nceas.metacat.restservice.D1RestServlet

- All Implemented Interfaces:
    java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
  Direct Known Subclasses:
    CNRestServlet, CNRestServlet, MNRestServlet, MNRestServlet

      public class D1RestServlet
      extends javax.servlet.http.HttpServlet

  Metacat implemantation of Earthgrid (Ecogrid) REST API as a servlet. In each request REST Servlet initialize a D1ResourceHandler object and then D1ResourceHandler object handles with request and writes approriate response.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected D1ResourceHandler` | `handler`
    `protected org.apache.log4j.Logger` | `logMetacat`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `D1RestServlet()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected D1ResourceHandler` | `createHandler(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)` Subclasses should override this method to provide the appropriate handler subclass
    `protected void` | `doDelete(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)` Handle "DELETE" method requests from HTTP clients
    `protected void` | `doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)` Handle "GET" method requests from HTTP clients
    `protected void` | `doHead(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)` Handle "PUT" method requests from HTTP clients
    `protected void` | `doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)` Handle "POST" method requests from HTTP clients
    `protected void` | `doPut(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)` Handle "PUT" method requests from HTTP clients
    `void` | `init(javax.servlet.ServletConfig config)` Initalize servlet by setting logger

    - ### Methods inherited from class javax.servlet.http.HttpServlet

      `doOptions, 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

    - #### logMetacat

          protected org.apache.log4j.Logger logMetacat

    - #### handler

          protected D1ResourceHandler handler

  - ### Constructor Detail

    - #### D1RestServlet

          public D1RestServlet()

  - ### Method Detail

    - #### createHandler

          protected D1ResourceHandler createHandler(javax.servlet.http.HttpServletRequest request,
                                                    javax.servlet.http.HttpServletResponse response)
                                             throws javax.servlet.ServletException,
                                                    java.io.IOException

      Subclasses should override this method to provide the appropriate handler subclass
      Parameters:
        `request` -
        `response` -
      Returns:
      Throws:
        `javax.servlet.ServletException`
        `java.io.IOException`

    - #### init

          public void init(javax.servlet.ServletConfig config)
                    throws javax.servlet.ServletException

      Initalize servlet by setting logger
      Specified by:
        `init` in interface `javax.servlet.Servlet`
      Overrides:
        `init` in class `javax.servlet.GenericServlet`
      Throws:
        `javax.servlet.ServletException`

    - #### doGet

          protected void doGet(javax.servlet.http.HttpServletRequest request,
                               javax.servlet.http.HttpServletResponse response)
                        throws javax.servlet.ServletException,
                               java.io.IOException

      Handle "GET" method requests from HTTP clients
      Overrides:
        `doGet` in class `javax.servlet.http.HttpServlet`
      Throws:
        `javax.servlet.ServletException`
        `java.io.IOException`

    - #### doPost

          protected void doPost(javax.servlet.http.HttpServletRequest request,
                                javax.servlet.http.HttpServletResponse response)
                         throws javax.servlet.ServletException,
                                java.io.IOException

      Handle "POST" method requests from HTTP clients
      Overrides:
        `doPost` in class `javax.servlet.http.HttpServlet`
      Throws:
        `javax.servlet.ServletException`
        `java.io.IOException`

    - #### doDelete

          protected void doDelete(javax.servlet.http.HttpServletRequest request,
                                  javax.servlet.http.HttpServletResponse response)
                           throws javax.servlet.ServletException,
                                  java.io.IOException

      Handle "DELETE" method requests from HTTP clients
      Overrides:
        `doDelete` in class `javax.servlet.http.HttpServlet`
      Throws:
        `javax.servlet.ServletException`
        `java.io.IOException`

    - #### doPut

          protected void doPut(javax.servlet.http.HttpServletRequest request,
                               javax.servlet.http.HttpServletResponse response)
                        throws javax.servlet.ServletException,
                               java.io.IOException

      Handle "PUT" method requests from HTTP clients
      Overrides:
        `doPut` in class `javax.servlet.http.HttpServlet`
      Throws:
        `javax.servlet.ServletException`
        `java.io.IOException`

    - #### doHead

          protected void doHead(javax.servlet.http.HttpServletRequest request,
                                javax.servlet.http.HttpServletResponse response)
                         throws javax.servlet.ServletException,
                                java.io.IOException

      Handle "PUT" method requests from HTTP clients
      Overrides:
        `doHead` in class `javax.servlet.http.HttpServlet`
      Throws:
        `javax.servlet.ServletException`
        `java.io.IOException`

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