Class 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 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 to text/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

      • 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

      • reportRequestProcTime

        public final boolean reportRequestProcTime
        If true 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

    • 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 be null.
        props - The properties. Must not be null.
        Throws:
        com.thetransactioncompany.util.PropertyParseException - On a missing or invalid property.