JadeRestService Class

A transient instance of a subclass of a JadeRestService class is created by each REST service application and used by each REST services message that is received. The processRequest method is called on this object, passing the message details in the URL. The method decodes the URL and any objects passed in XML or JSON format, and calls the required method on the same JadeRestService object. The result returned by the method is encoded into XML or JSON, as requested. The reply method is then called, passing the string to be returned to the client.

The constants defined in the JadeRestService class are summarized in the following table.

JadeRestService Class Constant Value Exceptions are in...
EncryptionAlg_HS256 String = "HS256" HS256 encryption algorithm used for signing JSON Web Tokens
EncryptionAlg_HS384 String = "HS384" HS384 encryption algorithm used for signing JSON Web Tokens
EncryptionAlg_HS512 String = "HS512" HS512 encryption algorithm used for signing JSON Web Tokens
EncryptionAlg_RS256 String = "RS256" RS256 encryption algorithm used for signing JSON Web Tokens
OutputFormat_Json Integer = 0 JSON (Microsoft JSON) format
OutputFormat_Xml Integer = 1 XML format (the default)
OutputFormat_Json_NewtonSoft Integer = 2 JSONN (NewtonSoft JSON) format
ServerVariable_AllHttp String = "ALL_HTTP" Used as a parameter to the fetchJWT method to return all HTTP headers sent by the client
ServerVariable_AllRaw String = "ALL_RAW" Used as a parameter to the fetchJWT method to return all headers sent by the client
ServerVariable_CacheURL String = "CACHE_URL" Incoming URL of the request
ServerVariable_ContentType String = "CONTENT_TYPE" HTTP header content type information of the request
ServerVariable_Host String = "HOST" HTTP header host information of the request
ServerVariable_HttpAccept String = "HTTP_ACCEPT" HTTP header HTTP accept information of the request
ServerVariable_Https String = "HTTPS" HTTP header HTTPS information of the request
ServerVariable_QueryString String = "QUERY_STRING" HTTP header query string information of the request
ServerVariable_RemoteAddr String = "REMOTE_ADDR" HTTP header remote address information of the request
ServerVariable_RemotePort String = "REMOTE_PORT" HTTP header remote port information of the request
ServerVariable_ServerName String = "SERVER_NAME" HTTP header server name information of the request
ServerVariable_ServerPort String = "SERVER_PORT" HTTP header server port information of the request
ServerVariable_URL String = "URL" HTTP header URL information of the request
ServerVariable_UserAgent String = "USER_AGENT" HTTP header user agent information of the request
ShadowMethodPrefix String = "s__" Prefix prepended by Jade to the beginning of a REST API method to create a shadow method, responsible for the association of required claims with that method

The properties defined in the JadeRestService class are summarized in the following table.

Property Contains the …
exceptionFormat Output format used at run time to generate REST service call exceptions
httpStatusCode HTTP status code error returned to the client
objectsToBeDeleted Array for non-shared transient objects to be deleted when the REST method has completed

The methods defined in the JadeRestService class are summarized in the following table.

Method Description
addResponseHeaderField Adds HTTP header fields for an individual Direct REST response
createVirtualDirectoryFile Passes files created by a Jade application to the jadehttp library (applies only to legacy IIS REST services)
deleteVirtualDirectoryFile Deletes specified files from the virtual directory used by the jadehttp library (applies only to legacy IIS REST services)
getOutputFormat Returns an Integer value that represents the output format
fetchJWT Returns the bearer token from the Authorization: Bearer HTTP header of the incoming REST request
fetchSecret Returns the secret with which to validate symmetrically‑signed tokens
getServerVariable Returns the specified HTTP header information for your REST service request from the Internet Information Server (IIS)
getTargetMethod Gets the name of the method targeted by the incoming REST request
isVDFilePresent Returns true if the specified file is present in the virtual directory used by the jadehttp library (applies only to legacy IIS REST services)
processRequest Processes the received message
reply Sends the returned value from the called method to the client
replyBinary Sends the returned value from the called method in Direct REST responses to the client as a binary payload; for example, an image or audio file
validateShadowMethod Returns true if the method is a valid shadow method of a REST service method
validateToken Validates a JSON Web Token against the required claims associated with the specified method

For details, see "JadeRestService Class", in Chapter 1 of the Encyclopaedia of Classes.