Class JSONRPC2WebAPIConfiguration
- java.lang.Object
-
- com.nimbusds.common.config.JSONRPC2WebAPIConfiguration
-
- All Implemented Interfaces:
LoggableConfiguration
public class JSONRPC2WebAPIConfiguration extends Object implements LoggableConfiguration
JSON-RPC 2.0 web API configuration. Connect2id web services with additional API configuration properties can extend this class.The configuration is stored as public fields which become immutable (final) after their initialisation.
Property keys: [prefix]*
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
DEFAULT_EXPOSE_EXCEPTIONS
The default expose exceptions policy.static boolean
DEFAULT_REPORT_REQUEST_PROC_TIME
The default request processing time reporting.static String
DEFAULT_RESPONSE_CONTENT_TYPE
The default response content type.boolean
exposeExceptions
Iftrue
the web service will expose exception details to clients in the JSON-RPC 2.0 error "data" field.boolean
reportRequestProcTime
Iftrue
enables reporting of request processing time by appending a non-standard "xProcTime" attribute to the JSON-RPC 2.0 responses.String
responseContentType
The value of the HTTP "Content-Type" header for the JSON-RPC 2.0 responses.-
Fields inherited from interface com.nimbusds.common.config.LoggableConfiguration
LOG_CATEGORY
-
-
Constructor Summary
Constructors Constructor Description JSONRPC2WebAPIConfiguration(String prefix, Properties props)
Creates a JSON-RPC 2.0 web API configuration from the specified properties.
-
-
-
Field Detail
-
responseContentType
public final String responseContentType
The value of the HTTP "Content-Type" header for the JSON-RPC 2.0 responses.Typically set to
application/json;charset=utf-8
or totext/plain;charset=utf-8
to support browser CORS requests.Note that the charset must always be defined and set to
utf-8
.Property key: [prefix]responseContentType
-
DEFAULT_RESPONSE_CONTENT_TYPE
public static final String DEFAULT_RESPONSE_CONTENT_TYPE
The default response content type.- See Also:
- Constant Field Values
-
exposeExceptions
public final boolean exposeExceptions
If
true
the web service will expose exception details to clients in the JSON-RPC 2.0 error "data" field. Use this setting for debugging purposes or if the web clients are trusted.If
false
the web service will not provide any exception details in JSON-RPC 2.0 errors. Use this setting if the web clients are not trusted or if they don't need to know details about encountered exceptions.Property key: [prefix]exposeExceptions
-
DEFAULT_EXPOSE_EXCEPTIONS
public static final boolean DEFAULT_EXPOSE_EXCEPTIONS
The default expose exceptions policy.- See Also:
- Constant Field Values
-
reportRequestProcTime
public final boolean reportRequestProcTime
Iftrue
enables reporting of request processing time by appending a non-standard "xProcTime" attribute to the JSON-RPC 2.0 responses.Intended for debugging and testing purposes. Disabled by default to prevent parse exceptions by clients which don't allow unexpected JSON attributes in the JSON-RPC 2.0 response messages.
Property key: [prefix]reportRequestProcTime
-
DEFAULT_REPORT_REQUEST_PROC_TIME
public static final boolean DEFAULT_REPORT_REQUEST_PROC_TIME
The default request processing time reporting.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JSONRPC2WebAPIConfiguration
public JSONRPC2WebAPIConfiguration(String prefix, Properties props) throws com.thetransactioncompany.util.PropertyParseException
Creates a JSON-RPC 2.0 web API configuration from the specified properties.Mandatory properties:
- none
Optional properties, with defaults:
- [prefix]responseContentType = application/json; charset=utf-8
- [prefix]exposeExceptions = false
- [prefix]reportRequestProcTime = false
- Parameters:
prefix
- The properties prefix. Must not benull
.props
- The properties. Must not benull
.- Throws:
com.thetransactioncompany.util.PropertyParseException
- On a missing or invalid property.
-
-
Method Detail
-
log
public void log()
Logs the configuration details at INFO level.- Specified by:
log
in interfaceLoggableConfiguration
-
-