IRISLIB database
REST Class Reference

Utilities used in the DeepSee rest services. More...

Inheritance diagram for REST:
Collaboration diagram for REST:

Static Public Member Functions

_.Library.Status OnPreDispatch (_.Library.String pUrl, _.Library.String pMethod, _.Library.Boolean pContinue)
 This method Gets called prior to dispatch of the request. More...
 
- Static Public Member Functions inherited from REST
_.Library.Boolean AcceptsContentType (_.Library.String pType)
 This method tests the HTTP_ACCEPT header and returns true if. More...
 
_.Library.Status AccessCheck (_.Library.Boolean pAuthorized)
 This method performs a basic access check. More...
 
_.Library.Status DispatchRequest (_.Library.String url, _.Library.String method, _.Library.Boolean forwarded, args)
 Dispatch a REST request according to URL and Method. More...
 
_.Library.Status Error (_.Library.Boolean skipheader)
 Called for a REST page in the event of an error being trapped by CSP server.
 
_.Library.String GetAuthChallenge ()
 This method determines what challenge will be sent with a 401 (Unauthorized) response. More...
 
_.Library.Status Http403 (_.Library.Status pSC)
 Issue a '403' error (Deprecated, use ..ReportHttpStatusCode)
 
_.Library.Status Http404 (_.Library.Status pSC)
 Issue a '404' error (Deprecated, use ..ReportHttpStatusCode)
 
_.Library.Status Http405 (_.Library.String pSupportedVerbs)
 Issue a '405' error ( user can override)
 
_.Library.Status Http500 (_.Exception.AbstractException pE)
 Issue a '500' error and give some indication as to what occurred.
 
_.Library.Status Login (_.Library.Boolean skipheader)
 Called for a REST page in the event of a login being required.
 
_.Library.Status Page (_.Library.Boolean skipheader)
 This method matches the request and method and calls the dispatcher.
 
_.Library.Status ReportHttpStatusCode (pHttpStatus, _.Library.Status pSC)
 Issue an 'Http' error.
 
 SetResponseHeaderIfEmpty (_.Library.String pHeader, _.Library.String pValue)
 This utility method sets a response header only if it currently does not have a value.
 
_.Library.Status StatusToJSON (_.Library.Status pSC, _.Library.DynamicObject pJSON)
 Render a Status as JSON.
 
_.Library.Status StatusToProxyObject (_.Library.Status pSC, _.ZEN.proxyObject pJSON)
 Render a Status as JSON (in the form of an array of objects representing each status value).
 
_.Library.Status SupportedVerbs (pUrl, _.Library.String pVerbs)
 This generator creates the SupportedVerbs Method used to determine supported verbs to return for the OPTIONS request.
 
- Static Public Member Functions inherited from Login
 DrawCSS3STYLE ()
 Draw the style definitions for the login page. More...
 
 DrawHEAD (pTitle)
 Draw the HEAD section of the login page. More...
 
 DrawSTHEAD ()
 Draw the HEAD section of the security token page. More...
 
 DrawSTTitle (_.Library.String pTitle)
 Draw the title section of the security token page. More...
 
 DrawSTYLE ()
 Draw the style definitions for the login page. More...
 
 DrawTitle (_.Library.String pTitle)
 Draw the title section of the login page. More...
 
 DrawTitleSection (_.Library.String msgs)
 Draw the title section of the page. More...
 
_.Library.Status OnHandleCorsRequest (_.Library.String url)
 This is the CORS request handler. More...
 
_.Library.Status OnHandleOptionsRequest (_.Library.String url)
 This methods provides handling of the options request for this CSP application. More...
 
_.Library.Status OnPage ()
 Output the default login page as HTML.
 
_.Library.Boolean OnPreHTTP ()
 Determine if we need login CSRF tokens and if so add them. More...
 
- Static Public Member Functions inherited from Page
_.Library.Status ConvertParameter (_.Library.String url, _.Library.String name, _.Library.String value)
 You pass this the <parameter>url</parameter> of the page you are going to and a. More...
 
_.Library.Binary Decrypt (_.Library.String data)
 Decrypts the input string using the session.Key value that is unique to. More...
 
_.Library.String Encrypt (_.Library.Binary data)
 Encrypts the input string using the session.Key value that is unique to this. More...
 
_.Library.String EscapeHTML (in)
 This method converts input HTML text into Escaped HTML text.
 
_.Library.String EscapeURL (_.Library.String in, _.Library.String charset)
 This method converts the in input URL string into Escaped URL string. More...
 
_.Library.String HyperEventCall (_.Library.String methodName, _.Library.String args, _.Library.Integer type, _.Library.Boolean mobile)
 This method returns the string that needs to be written to the current. More...
 
_.Library.String HyperEventHead (_.Library.Boolean iframeOnly, _.Library.Boolean strict, _.Library.Boolean optionalBroker)
 This method returns the string that needs to be written to the current. More...
 
 Include (_.Library.String url)
 Include another csp page or file in the output at this point. More...
 
_.Library.String InsertHiddenField (_.Library.String url, _.Library.String name, _.Library.String value, _.Library.String extra)
 Inserts a '<input type="hidden" name="Name" value="Value">' tag into the current document. More...
 
_.Library.String InsertHiddenFields (_.Library.String url, _.Library.String query)
 Return the string containing the hidden form tags. More...
 
_.Library.Boolean IsPrivate ()
 Returns 1 if this page is in fact a private page (see <parameter>PRIVATE</parameter>).
 
_.Library.String Link (_.Library.String link, _.Library.String query, _.Library.Boolean addQ)
 Tranforms the link specified by link into a URL and returns it as a string. More...
 
_.Library.Status OnHTTPHeader (_.Library.Boolean OutputBody)
 Event handler for PAGE event: this is invoked in order to
More...
 
 OnPageError (_.Library.Status sc)
 Event handler for any error that occurs on the page. More...
 
 OnPostHTTP ()
 Event handler for POSTPAGE event: this is invoked after the data. More...
 
_.Library.Status OnPostHyperEvent (_.Library.String class, _.Library.String method)
 Event handler which is invoked after a hyperevent method is called on this page.
 
_.Library.Status OnPreHyperEvent (_.Library.String class, _.Library.String method)
 Event handler which is invoked before a hyperevent method is called on this page. More...
 
_.Library.String QuoteJS (in)
 This method converts input string into quoted JavaScript literal.
 
_.Library.String RewriteURL (_.Library.String url)
 This method will rewrite a URL to use #url()# if needed.
 
 ShowError (_.Library.Status sc)
 Display a <class>Status</class> error code to the CSP Page.
 
 StartTimer (_.Library.String name)
 Used to get performance information on your CSP pages. More...
 
 StopTimer (_.Library.String name)
 Used to time performance information on your CSP pages. More...
 
 ThrowError (_.Library.Status sc)
 Passed a <class>Status</class> code this goes to the error page passing this status code.
 
_.Library.String UnescapeHTML (in)
 This method converts Escaped HTML text into normal HTML text.
 
_.Library.String UnescapeURL (_.Library.String in, _.Library.String charset)
 This method converts the in Escaped URL string back to its original form. More...
 

Static Public Attributes

 CHARSET = None
 Specifies the default character set for the page. More...
 
 CONTENTTYPE = None
 Specifies the default content type for the page. More...
 
 HandleCorsRequest = None
 This parameter influences the CORS support. More...
 
- Static Public Attributes inherited from REST
 HandleCorsRequest = None
 This parameter influences the CORS support. More...
 
 TokenLoginEndpoint = None
 If the REST application is using token authentication, then this parameter gives the path to use for the "login" endpoint. More...
 
 TokenLogoutEndpoint = None
 If the REST application is using token authentication, then this parameter gives the path to use for the "logout" endpoint. More...
 
 TokenRefreshEndpoint = None
 If the REST application is using token authentication, then this parameter gives the path to use for the "refresh" endpoint. More...
 
 TokenRevokeEndpoint = None
 If the REST application is using token authentication, then this parameter gives the path to use for the token revocation endpoint. More...
 
 UseSession = None
 This parameter controls the CSP session support. More...
 
- Static Public Attributes inherited from Login
 DOMAIN = None
 Provide a default login and security-token pages for CSP applications. More...
 
 FAVORITEICON = None
 Home favorite icon.
 
 HandleCorsRequest = None
 This parameter influences the CORS support for the CSP application that has this login page assigned. More...
 
 LOGINTITLE = None
 Title displayed for login page. More...
 
 STYLESHEET = None
 Name of stylesheet used for login page. More...
 
- Static Public Attributes inherited from Page
 CHARSET = None
 The <CLASS>CSP.Page</CLASS> object serves as an event handler for CSP requests. More...
 
 CONTENTTYPE = None
 Specifies the default content type for the page. More...
 
 CONVERTINPUTSTREAM = None
 Specifies if input request.Content or request.MimeData values are converted from their. More...
 
 CSPFILE = None
 If this page was compiled from a .csp file, then this parameter contains the. More...
 
 CSPSTRICT = None
 The CSPSTRICT parameter is set to 1, if the DOCTYPE indicates that this. More...
 
 CSPURL = None
 This parameter is used to make sure that if multiple. More...
 
 CSPXHTML = None
 The CSPXHTML parameter is set to 1, if the DOCTYPE indicates that this. More...
 
 DOMAIN = None
 The default domain for csp:text, span and div tags. More...
 
 ENCODED = None
 Controls how the query parameters for this page are passed, it can. More...
 
 ERRORPAGE = None
 Specify a custom error page to call if there are any problems with generating this page. More...
 
 EXPIRES = None
 Specified the default value for the response.Expires. More...
 
 NOCHARSETCONVERT = None
 Specifies if we wish to turn off charset conversion for this page. More...
 
 PAGETIMING = None
 If this parameter is true then we automatically record timing statistics of how long it takes to. More...
 
 PRIVATE = None
 Controls the access to the page, it can be set to one of the following:
More...
 
 SECURITYRESOURCE = None
 This is a comma-delimited list of system Resources and associated. More...
 
 TIMINGSLOTS = None
 Used by the timing to decide how many slots a day should be divided up into. More...
 
 UseSession = None
 This parameter controls the CSP session support. More...
 

Static Private Member Functions

 Array2JSON (array)
 Converts an objectscript array that may have an arbitrary structure, to a JSON object. More...
 
_.Library.Status ConstructResponseFromArray (pArray, _.Library.List pMetaData, pNodeLabel, _.Library.Status pFetchStatus, pResponseObj, pProvider)
 This utility assists in constructing a standardized JSON response object from an array. More...
 
_.Library.DynamicObject ConstructResponseObject (pInfoObj, pResultObj, pProvider)
 Create a template response object.
 
_.Library.Status ConvertErrorStatusToJSON (_.Library.Status pStatus, _.Library.String statusAsJSONString)
 Converts a Status object that contains an error, to a JSON string, but does not cause it to be output to the console (unlike DeepSee.REST.REST.ErrorToJSON, thus allowing for it to be used as a string wherever required. More...
 
_.Library.Status CreateObjectFromArray (pArray, _.Library.List pMetaData, pObject)
 This consumes an array and attempts to create a dynamic object out of it. More...
 
_.Library.Status ErrorToJSON (_.Library.Status pStatus)
 Convert a Status object that contains an error into JSON for transmission back to the client. More...
 
_.Library.String ExtractDatasourceName (pUrl, pType, _.Library.String pRemainder, _.Library.Status pStatus)
 DeepSee REST APIs permit use of the "/" character in data source names and dimension specs. More...
 
_.Library.Status SetRequestField (_.Library.String pPropertyName, pCurrentInput, pDefaultValue, ans, _.Library.String pTargetClass)
 This method sets a request field to its current value as passed in the request.Content section of the POST request or, if that does not exist, sets it to its default value as specified in the method signature in CubeManager.Utils. More...
 
_.Library.Status ValidateRequest (_.Library.String pUrl, _.Library.String pMethod)
 Perform specific validation for the service that will handle the request. More...
 
_.Library.Status WaitForProviderResults (_.ZEN.Auxiliary.jsonMDXProvider pProvider, _.Library.Integer pTimeout)
 Given an instance of the jsonMDXProvider, begin executing the query and wait for results. More...
 

Detailed Description

Utilities used in the DeepSee rest services.

Member Function Documentation

◆ Array2JSON()

Array2JSON (   array)
staticprivate

Converts an objectscript array that may have an arbitrary structure, to a JSON object.

array is the array to be converted

◆ ConstructResponseFromArray()

_.Library.Status ConstructResponseFromArray (   pArray,
_.Library.List  pMetaData,
  pNodeLabel,
_.Library.Status  pFetchStatus,
  pResponseObj,
  pProvider 
)
staticprivate

This utility assists in constructing a standardized JSON response object from an array.

of lists, as commonly returned by DeepSee utilities. The data in pArray must be organized in the form
pArray(index) = $LB(data1,data2,data3)
where the contents in each list are converted to name-value pairs using the list of labels provided in pMetaData. The array of objects is placed in the Result section of the dynamic object returned via pResponseObj. The specifc node within the Result section is labeled according to the string supplied in pNodeLabel.
For convenience, the method may return an instance of the <class>ZEN.Auxiliary.jsonMDXProvider</class> used to augment the response object with more dynamic objects or arrays, as well as convert the object to JSON when the response object is complete.

◆ ConvertErrorStatusToJSON()

_.Library.Status ConvertErrorStatusToJSON ( _.Library.Status  pStatus,
_.Library.String  statusAsJSONString 
)
staticprivate

Converts a Status object that contains an error, to a JSON string, but does not cause it to be output to the console (unlike DeepSee.REST.REST.ErrorToJSON, thus allowing for it to be used as a string wherever required.

If a non-error status is passed in, an empty string will be returned becuase the underlying method tProvider.StatusToDynamicObject does not convert $$$OK statuses to dynamic objects May need to be refactored if Zen is phased out

◆ CreateObjectFromArray()

_.Library.Status CreateObjectFromArray (   pArray,
_.Library.List  pMetaData,
  pObject 
)
staticprivate

This consumes an array and attempts to create a dynamic object out of it.

This object can then be further

augmented or pruned, and can be used as a facility for converting the content to JSON.

◆ ErrorToJSON()

_.Library.Status ErrorToJSON ( _.Library.Status  pStatus)
staticprivate

Convert a Status object that contains an error into JSON for transmission back to the client.

The error will be located in the same

position within the object as with any JSON MDX resultset return. If there is a reported error, the existence of other properties within the return object is not guaranteed.

◆ ExtractDatasourceName()

_.Library.String ExtractDatasourceName (   pUrl,
  pType,
_.Library.String  pRemainder,
_.Library.Status  pStatus 
)
staticprivate

DeepSee REST APIs permit use of the "/" character in data source names and dimension specs.

Given a piece of a pUrl that begins with a data source, this searches for the first valid data source name and returns it. This can be limited by type or a list of types in the comma-delimited list pType. Currently supported datasource types are "kpi" and "cube"
The remainder of the URL, if it exists, is returned in the pRemainder.

◆ SetRequestField()

_.Library.Status SetRequestField ( _.Library.String  pPropertyName,
  pCurrentInput,
  pDefaultValue,
  ans,
_.Library.String  pTargetClass 
)
staticprivate

This method sets a request field to its current value as passed in the request.Content section of the POST request or, if that does not exist, sets it to its default value as specified in the method signature in CubeManager.Utils.

Example: SetRequestField is being invoked to set the value for the field request.Content.myField pPropertyName is a string values containing the name of the field. For the above example,the pProperty is "myField" pCurrentInput is the current input value for the field in question. For the above example, the pCurrentInput is request.Content.myField pDefaultValue is the default value for the field in question, as specified in the signature of the corresponding method that the API is designed to call. For the above example, the pDefaultValue could be "5" ans is the variable or object reference in which the populated value is stored
pTargetClass is an optional argument that contains the name of the class, that ans should be an object of. This is only passed in when ans is expected to be an object and not a variable. An example of this is "%DeepSee.CubeManager.RegistryMapCube"

◆ ValidateRequest()

_.Library.Status ValidateRequest ( _.Library.String  pUrl,
_.Library.String  pMethod 
)
staticprivate

Perform specific validation for the service that will handle the request.

This is used

as a callback in each service that extends DeepSee.REST

Reimplemented in DataServer, CommandServer, DataServer, CommandServer, DataServer, v3, v2, and v1.

◆ WaitForProviderResults()

_.Library.Status WaitForProviderResults ( _.ZEN.Auxiliary.jsonMDXProvider  pProvider,
_.Library.Integer  pTimeout 
)
staticprivate

Given an instance of the jsonMDXProvider, begin executing the query and wait for results.

Quit early if the value supplied by pTimeout is reached.

◆ OnPreDispatch()

_.Library.Status OnPreDispatch ( _.Library.String  pUrl,
_.Library.String  pMethod,
_.Library.Boolean  pContinue 
)
static

This method Gets called prior to dispatch of the request.

Put any common code here

that you want to be executed for EVERY request. If pContinue is set to 0, the request will NOT be dispatched according to the UrlMap. If this case it's the responsibility of the user to return a response.

Reimplemented from REST.

Member Data Documentation

◆ CHARSET

CHARSET = None
static

Specifies the default character set for the page.

This can be overriden using the

<CSP:CONTENT CHARSET=> tag, or by setting the response.CharSet property in the <method>OnPreHTTP</method> method. If this parameter is not specified, then for the default charset is utf-8.

◆ CONTENTTYPE

CONTENTTYPE = None
static

Specifies the default content type for the page.

This can be overriden using the

<CSP:CONTENT TYPE=> tag, or by setting the response.ContentType property in the <method>OnPreHTTP</method> method. The default value if this parameter is not set is text/html.

◆ HandleCorsRequest

HandleCorsRequest = None
static

This parameter influences the CORS support.

The default is an empty string meaning 'not specified'.

If set to true (1) then CORS processing is ON. If set to false (0) then CORS processing is OFF. If left unset "" then the decision to process CORS is delegated to the setting on the URL map route.