Package com.nimbusds.common.jsonrpc2
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
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
Modifier and TypeFieldDescriptionprotected 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.protected RequestHandlerWithLifecycle
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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
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
-
Field Details
-
service
The target JSON-RPC 2.0 service. -
wsName
The web service name. -
wsVersion
The web service version. -
banner
The Connect2id service banner, printed at the HTTP GET endpoint. -
responseContentType
The HTTP (POST) response content type of JSON-RPC 2.0 responses. -
httpStatusCodeMapper
Optional mapper of JSON-RPC 2.0 error codes to HTTP status codes.
-
-
Constructor Details
-
JSONRPC2Servlet
public JSONRPC2Servlet()
-
-
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 classjakarta.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 classjakarta.servlet.http.HttpServlet
- Parameters:
httpRequest
- The HTTP request.httpResponse
- The output HTTP response.- Throws:
jakarta.servlet.ServletException
- On a request handling exception.
-
destroy
Called at servlet shutdown. Stops the Connect2id web service, exceptions are logged at WARN level.- Specified by:
destroy
in interfacejakarta.servlet.Servlet
- Overrides:
destroy
in classjakarta.servlet.GenericServlet
-