Package com.nimbusds.common.jsonrpc2
Class JSONRPC2LogUtility
java.lang.Object
com.nimbusds.common.jsonrpc2.JSONRPC2LogUtility
Helper methods for Log4j message generation.
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.thetransactioncompany.jsonrpc2.JSONRPC2Request
hideParameter
(com.thetransactioncompany.jsonrpc2.JSONRPC2Request request, String paramName) Hides the value of the specified parameter in a JSON-RPC 2.0 request.static com.thetransactioncompany.jsonrpc2.JSONRPC2Request
hidePassword
(com.thetransactioncompany.jsonrpc2.JSONRPC2Request request) Hides the "password" parameter value in a JSON-RPC 2.0 request.static void
log
(com.thetransactioncompany.jsonrpc2.JSONRPC2Request request, com.thetransactioncompany.jsonrpc2.JSONRPC2Response response) Logs (at INFO level) the name of the JSON-RPC 2.0 request and the resulting response (success or error code + message).static void
log
(com.thetransactioncompany.jsonrpc2.JSONRPC2Request request, com.thetransactioncompany.jsonrpc2.JSONRPC2Response response, String prefix) Logs (at INFO level) the name of the JSON-RPC 2.0 request and the resulting response (success or error code + message).
-
Method Details
-
log
public static void log(com.thetransactioncompany.jsonrpc2.JSONRPC2Request request, com.thetransactioncompany.jsonrpc2.JSONRPC2Response response, String prefix) Logs (at INFO level) the name of the JSON-RPC 2.0 request and the resulting response (success or error code + message). The message may be optionally prefixed.Format:
[prefix] request-method-name: Success | Error code: Message
Example:
[CID dff6fb77-7f96-4b82-a0f9-0ac25cfb1852] ldap.getEntry: Success [CID dff6fb77-7f96-4b82-a0f9-0ac25cfb1852] ldap.getEntry: Error -1000: Invalid/expired LDAP connection identifier (CID)
- Parameters:
request
- The JSON-RPC 2.0 request. Must not benull
.response
- The resulting JSON-RPC 2.0 response. Must not benull
.prefix
- The log message prefix. Ifnull
the log message will not be prefixed.
-
log
public static void log(com.thetransactioncompany.jsonrpc2.JSONRPC2Request request, com.thetransactioncompany.jsonrpc2.JSONRPC2Response response) Logs (at INFO level) the name of the JSON-RPC 2.0 request and the resulting response (success or error code + message).Format:
request-method-name: Success | Error code: Message
Example:
ldap.getEntry: Success ldap.getEntry: Error -1000 Invalid/expired LDAP connection identifier (CID)
- Parameters:
request
- The JSON-RPC 2.0 request. Must not benull
.response
- The resulting JSON-RPC 2.0 response. Must not benull
.
-
hideParameter
public static com.thetransactioncompany.jsonrpc2.JSONRPC2Request hideParameter(com.thetransactioncompany.jsonrpc2.JSONRPC2Request request, String paramName) Hides the value of the specified parameter in a JSON-RPC 2.0 request. The value is replaced by a string "[hidden]". If the specified parameter is not found request is returned unmodified.This method is intended for logging JSON-RPC 2.0 requests.
- Parameters:
request
- The JSON-RPC 2.0 request. May benull
.paramName
- The name of the parameter to hide. May benull
.- Returns:
- The processed JSON-RPC 2.0 request.
-
hidePassword
public static com.thetransactioncompany.jsonrpc2.JSONRPC2Request hidePassword(com.thetransactioncompany.jsonrpc2.JSONRPC2Request request) Hides the "password" parameter value in a JSON-RPC 2.0 request. The value is replaced by a string "[hidden]". If no "password" parameter is contained the request is returned unmodified.This method is intended for logging JSON-RPC 2.0 requests.
- Parameters:
request
- The JSON-RPC 2.0 request. May benull
.- Returns:
- The JSON-RPC 2.0 request with any password value hidden.
-