%DocDB.REST
Class %DocDB.REST Extends %CSP.REST
This class implements a custom response format and serves as the basis for all DocDB REST APIs
Parameters
DOMAIN
Parameter DOMAIN = "%DOCDB";
Methods
Http500
ClassMethod Http500(pE As %Exception.AbstractException) As %Status
Use our special format Http500 handler
ReportHttpStatusCode
ClassMethod ReportHttpStatusCode(httpStatus, status As %Status = {$$$OK}) As %Status
User our special format handler for other status codes
RenderResponseBody
ClassMethod RenderResponseBody(httpStatus As %String = "", error As %DynamicAbstractObject = "", content As %DynamicAbstractObject = "") As %Status
Render the three-part Response Body which contains an status, console, and a result part
GetClientServerHash
ClassMethod GetClientServerHash() As %String [ CodeMode = expression, Internal ]
Get the clients version of the server hash
SetClientServerHash
ClassMethod SetClientServerHash(pHash As %String)
Set the clients version of the server hash
ServeXml
ClassMethod ServeXml(pDocName As %String, pStatus As %Status, pMsgArray As %DynamicArray, pStream As %Stream, pTimeStamp As %String = "") As %Status
This private helper method server wraps the message and document and returns it to the caller
Page
ClassMethod Page(skipheader As %Boolean = 1) As %Status [ ProcedureBlock = 0 ]
Sets the response's localization domain (something that %CSP.REST should do, in theory) and then invokes default super class behavior
getRequestBody
ClassMethod getRequestBody() As %DynamicAbstractObject
AccessibleNamespaces
ClassMethod AccessibleNamespaces()
This method returneds a list of accessible namespaces
exceptionToHttpResponse
ClassMethod exceptionToHttpResponse(exception As %Exception.AbstractException) As %String
set status = exception.AsStatus() do ..StatusToJSON(status,.statusObject) All exceptions can have an inner exception Status exceptions can also have NextException, forming a linked list structure This can be normalized by converting the exception to a dynamic object and then we process the dynamic object
exceptionToHttpStatus
ClassMethod exceptionToHttpStatus(exception As %Exception.AbstractException) As %Library.DynamicAbstractObject
Map an exception graph to an http status code
SQLCODEToHttpStatus
ClassMethod SQLCODEToHttpStatus(SQLCODE As %Integer) As %String