Package com.nimbusds.common.jsonrpc2
Class JSONRPC2Servlet
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- com.nimbusds.common.jsonrpc2.JSONRPC2Servlet
-
- All Implemented Interfaces:
Serializable
,javax.servlet.Servlet
,javax.servlet.ServletConfig
public abstract class JSONRPC2Servlet extends javax.servlet.http.HttpServlet
Base abstract JSON-RPC 2.0 request servlet for Connect2id services. Requests are received at theHTTP POST endpoint
and passed toservice
for processing. TheHTTP GET endpoint
prints out abanner 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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Banner
banner
The Connect2id service banner, printed at the HTTP GET endpoint.protected String
responseContentType
The HTTP (POST) response content type of JSON-RPC 2.0 responses.protected RequestHandlerWithLifecycle
service
The target JSON-RPC 2.0 service.protected String
wsName
The web service name.protected String
wsVersion
The web service version.
-
Constructor Summary
Constructors Constructor Description JSONRPC2Servlet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
Called at servlet shutdown.void
doGet(javax.servlet.http.HttpServletRequest httpRequest, javax.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(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse)
Receives JSON-RPC 2.0 requests for the Connect2id service by means of HTTP POST.-
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
-
-
-
-
Field Detail
-
service
protected RequestHandlerWithLifecycle service
The target JSON-RPC 2.0 service.
-
responseContentType
protected String responseContentType
The HTTP (POST) response content type of JSON-RPC 2.0 responses.
-
-
Constructor Detail
-
JSONRPC2Servlet
public JSONRPC2Servlet()
-
-
Method Detail
-
doPost
public void doPost(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse) throws javax.servlet.ServletException
Receives JSON-RPC 2.0 requests for the Connect2id service by means of HTTP POST.- Overrides:
doPost
in classjavax.servlet.http.HttpServlet
- Parameters:
httpRequest
- The HTTP request.httpResponse
- The output HTTP response.- Throws:
javax.servlet.ServletException
- On a request handling exception.
-
doGet
public void doGet(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse) throws javax.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 classjavax.servlet.http.HttpServlet
- Parameters:
httpRequest
- The HTTP request.httpResponse
- The output HTTP response.- Throws:
javax.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 interfacejavax.servlet.Servlet
- Overrides:
destroy
in classjavax.servlet.GenericServlet
-
-