Class JSONRPC2Servlet

java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
com.nimbusds.common.jsonrpc2.JSONRPC2Servlet
All Implemented Interfaces:
jakarta.servlet.Servlet, jakarta.servlet.ServletConfig, Serializable

public abstract class JSONRPC2Servlet extends jakarta.servlet.http.HttpServlet
Base abstract JSON-RPC 2.0 request servlet for Connect2id services. Requests are received at the HTTP POST endpoint and passed to service for processing. The HTTP GET endpoint prints out a banner text message that identifies the web service name and version and lists the supported JSON-RPC 2.0 requests.

Inheriting servlets must initialise all protected members in their init(...) method.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected Banner
    The Connect2id service banner, printed at the HTTP GET endpoint.
    Optional mapper of JSON-RPC 2.0 error codes to HTTP status codes.
    protected String
    The HTTP (POST) response content type of JSON-RPC 2.0 responses.
    The target JSON-RPC 2.0 service.
    protected String
    The web service name.
    protected String
    The web service version.

    Fields inherited from class jakarta.servlet.http.HttpServlet

    LEGACY_DO_HEAD
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Called at servlet shutdown.
    void
    doGet(jakarta.servlet.http.HttpServletRequest httpRequest, jakarta.servlet.http.HttpServletResponse httpResponse)
    Outputs a simple text/plain banner message that identifies the Connect2id web service name/version and lists the supported JSON-RPC 2.0 requests.
    void
    doPost(jakarta.servlet.http.HttpServletRequest httpRequest, jakarta.servlet.http.HttpServletResponse httpResponse)
    Receives JSON-RPC 2.0 requests for the Connect2id service by means of HTTP POST.

    Methods inherited from class jakarta.servlet.http.HttpServlet

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

    Methods inherited from class jakarta.servlet.GenericServlet

    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

  • Constructor Details

  • Method Details

    • doPost

      public void doPost(jakarta.servlet.http.HttpServletRequest httpRequest, jakarta.servlet.http.HttpServletResponse httpResponse) throws jakarta.servlet.ServletException
      Receives JSON-RPC 2.0 requests for the Connect2id service by means of HTTP POST.
      Overrides:
      doPost in class jakarta.servlet.http.HttpServlet
      Parameters:
      httpRequest - The HTTP request.
      httpResponse - The output HTTP response.
      Throws:
      jakarta.servlet.ServletException - On a request handling exception.
    • doGet

      public void doGet(jakarta.servlet.http.HttpServletRequest httpRequest, jakarta.servlet.http.HttpServletResponse httpResponse) throws jakarta.servlet.ServletException
      Outputs a simple text/plain banner message that identifies the Connect2id web service name/version and lists the supported JSON-RPC 2.0 requests.
      Overrides:
      doGet in class jakarta.servlet.http.HttpServlet
      Parameters:
      httpRequest - The HTTP request.
      httpResponse - The output HTTP response.
      Throws:
      jakarta.servlet.ServletException - On a request handling exception.
    • destroy

      public void destroy()
      Called at servlet shutdown. Stops the Connect2id web service, exceptions are logged at WARN level.
      Specified by:
      destroy in interface jakarta.servlet.Servlet
      Overrides:
      destroy in class jakarta.servlet.GenericServlet