Package oracle.dbtools.plugin.api.servlet

## Class HttpServletBase

- java.lang.Object
- - javax.servlet.GenericServlet
  - - javax.servlet.http.HttpServlet
    - - oracle.dbtools.plugin.api.servlet.HttpServletBase

- All Implemented Interfaces:
    `java.io.Serializable`, `javax.servlet.Servlet`, `javax.servlet.ServletConfig`, `ErrorResponseHandler`, `HasDynamicAuthorization`, `SupportsPatch`

      public abstract class HttpServletBase
      extends javax.servlet.http.HttpServlet
      implements HasDynamicAuthorization, ErrorResponseHandler, SupportsPatch

  Alternative base class for `HttpServlet` implementations, providing `SupportsPatch` and `HasDynamicAuthorization` support.
  Author:
    cdivilly
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from interface oracle.dbtools.plugin.api.servlet.HasDynamicAuthorization

      `USE_DEFAULT_CONSTRAINTS`

    - ### Fields inherited from interface oracle.dbtools.plugin.api.servlet.SupportsPatch

      `PATCH`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `protected` | `HttpServletBase()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `doPatch​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)` | Perform a HTTP PATCH operation.
    `AuthorizationConstraint` | `getConstraint​(javax.servlet.http.HttpServletRequest request)` | Determine the `AuthorizationConstraint` that applies to a resource.
    `boolean` | `onError​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, int statusCode, java.lang.Throwable cause)` | Called when the runtime is about to raise an error condition (i.e report an HTTP status code in the 400-499 range).
    `protected void` | `service​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)` |

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

      `doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service`

    - ### Methods inherited from class javax.servlet.GenericServlet

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

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### HttpServletBase

          protected HttpServletBase()

  - ### Method Detail

    - #### doPatch

          public void doPatch​(javax.servlet.http.HttpServletRequest request,
                              javax.servlet.http.HttpServletResponse response)
                       throws javax.servlet.ServletException,
                              java.io.IOException

      Description copied from interface: `SupportsPatch`
      Perform a HTTP PATCH operation. The PATCH method requests that a set of changes described in the request entity be applied to the resource identified by the Request-URI. The set of changes is represented in a format called a "patch document" identified by a media type. The server MUST apply the entire set of changes atomically and never provide (e.g., in response to a GET during this operation) a partially modified representation. If the entire patch document cannot be successfully applied, then the server MUST NOT apply any of the changes.
      Specified by:
        `doPatch` in interface `SupportsPatch`
      Parameters:
        `request` - an `HttpServletRequest` object that contains the request the client has made of the servlet
        `response` - an `HttpServletResponse` object that contains the response the servlet sends to the client
      Throws:
        `javax.servlet.ServletException` - if the request for the PATCH could not be handled
        `java.io.IOException` - if an input or output error is detected when the servlet handles the PATCH request

    - #### getConstraint

          public AuthorizationConstraint getConstraint​(javax.servlet.http.HttpServletRequest request)
                                                throws javax.servlet.ServletException,
                                                       java.io.IOException

      Description copied from interface: `HasDynamicAuthorization`
      Determine the `AuthorizationConstraint` that applies to a resource.
      Specified by:
        `getConstraint` in interface `HasDynamicAuthorization`
      Parameters:
        `request` - an `HttpServletRequest` object that contains the request the client has made of the servlet
      Returns:
        `AuthorizationConstraint` instance if a constraint applies to the request. `null` if no constraint applies to the request. `HasDynamicAuthorization.USE_DEFAULT_CONSTRAINTS` if this method cannot determine what constraint applies to the request, and therefore the runtime's default `AuthorizationConstraint` discovery logic will be applied to the request.
      Throws:
        `javax.servlet.ServletException` - if the request for the dynamic privilege could not be handled
        `java.io.IOException` - if an input or output error is detected when the servlet determines the `AuthorizationConstraint`

    - #### onError

          public boolean onError​(javax.servlet.http.HttpServletRequest request,
                                 javax.servlet.http.HttpServletResponse response,
                                 int statusCode,
                                 java.lang.Throwable cause)
                          throws javax.servlet.ServletException,
                                 java.io.IOException

      Description copied from interface: `ErrorResponseHandler`
      Called when the runtime is about to raise an error condition (i.e report an HTTP status code in the 400-499 range).
      Specified by:
        `onError` in interface `ErrorResponseHandler`
      Parameters:
        `request` - The `HttpServletRequest` for the current request
        `response` - The `HttpServletResponse` for the current response
        `statusCode` - The HTTP status code to be raised
        `cause` - The cause of the error condition, may be null
      Returns:
        If this handler generates a response for the error condition this method must return `true`. If this method does not handle the error condition this method must return `false`. In which case the standard runtime's error handling will be invoked
      Throws:
        `javax.servlet.ServletException` - if the request cannot be handled
        `java.io.IOException` - if an I/O error occurs while reading the request or writing the response

    - #### service

          protected void service​(javax.servlet.http.HttpServletRequest req,
                                 javax.servlet.http.HttpServletResponse resp)
                          throws javax.servlet.ServletException,
                                 java.io.IOException

      Overrides:
        `service` in class `javax.servlet.http.HttpServlet`
      Throws:
        `javax.servlet.ServletException`
        `java.io.IOException`