DeepSee.RESTClient
class DeepSee.RESTClient extends %ZEN.Component.page
REST Application test bedThis is just a quick graphical alternative to cURL for people who need to exercise the API but hate to type
Out of the box, this sample was designed to run against the DocServer example in SAMPLES, but this can be customized by changing the SERVERCLASS parameter to point to a different subclass of %CSP.REST, and changing the cspApplication property to match the dispatch application defined in the management portal.
This page should be hosted on the same server that provides the REST services as it uses its own location.hostname properties for getting the host and port number of the server
Additionally, the processRequest() method has a username and password pair hardcoded into the method to save typing, this is fine for personal desk checking but should be customized or removed before sharing this code
Property Inventory
Method Inventory
- %OnAfterCreatePage()
- GetRouteData()
- buildRouteObject()
- changeApplication()
- changeNamespace()
- clearResponseArea()
- getRoutes()
- isSystemApplication()
- onloadHandler()
- processRequest()
- processResponse()
- renderRequestForm()
- renderRoutes()
- selectRoute()
- setRouting()
- submitRequest()
Parameters
parameter JSINCLUDES = zenCSLM.js,zenESVG.js,DeepSee.js;
Inherited description: Comma-separated list of additional JS include files for the page.
parameter SERVERCLASS = %DeepSee.REST.v1;
This is the name of the CLASS that defines the UrlMap (the core of a REST service)
that you wish to explore, it should be a subclass of %CSP.REST
Properties
property cspApplication as %ZEN.Datatype.string [ InitialExpression = "/api/deepsee" ];
This is the name of the REST dispatcher as defined in the SMP
Property methods: cspApplicationDisplayToLogical(), cspApplicationGet(), cspApplicationIsValid(), cspApplicationLogicalToDisplay(), cspApplicationLogicalToOdbc(), cspApplicationNormalize(), cspApplicationSet()
property namespace as %ZEN.Datatype.string [ InitialExpression = "SAMPLES" ];
Property methods: namespaceDisplayToLogical(), namespaceGet(), namespaceIsValid(), namespaceLogicalToDisplay(), namespaceLogicalToOdbc(), namespaceNormalize(), namespaceSet()
property requestUrl as %ZEN.Datatype.string;
Container for the current URL actually being used to send the request
Property methods: requestUrlDisplayToLogical(), requestUrlGet(), requestUrlIsValid(), requestUrlLogicalToDisplay(), requestUrlLogicalToOdbc(), requestUrlNormalize(), requestUrlSet()
property server as %ZEN.Datatype.string;
Property methods: serverDisplayToLogical(), serverGet(), serverIsValid(), serverLogicalToDisplay(), serverLogicalToOdbc(), serverNormalize(), serverSet()
property serverClass as %ZEN.Datatype.string [ InitialExpression = ..#SERVERCLASS ];
Property methods: serverClassDisplayToLogical(), serverClassGet(), serverClassIsValid(), serverClassLogicalToDisplay(), serverClassLogicalToOdbc(), serverClassNormalize(), serverClassSet()
Methods
method %OnAfterCreatePage() as %Status
This callback is called after the server-side page
object and all of its children are created.
Subclasses can override this to add, remove, or modify items within the page object model, or to provide values for controls.
Subclasses can override this to add, remove, or modify items within the page object model, or to provide values for controls.
classmethod GetRouteData(pDispatchClass="") as %ZEN.Datatype.string [ ZenMethod ]
Read the UrlMap XData section from the class given in the SERVERCLASS parameter
and export it as a block of XML. This is used by the client page to generate
on-screen request forms for exercising the various paths.
clientmethod buildRouteObject(xmlNode, prefix) [ Language = javascript ]
clientmethod changeApplication() [ Language = javascript ]
clientmethod changeNamespace() [ Language = javascript ]
clientmethod clearResponseArea() [ Language = javascript ]
clientmethod getRoutes() [ Language = javascript ]
The route data comes down from the server as an XML block (from the XData section
of whatever SERVERCLASS was defined) and needs to be converted to a JavaScript
object for local processing. The server side call here is the only reason this
page happens to be a Zen page, all the work done creating XMLHttpRequest objects
could have been done from any HTML5 web page, REST does not require the client to be
Zen or even CSP.
clientmethod isSystemApplication() [ Language = javascript ]
clientmethod onloadHandler() [ Language = javascript ]
Inherited description: This client event, if present, is fired when the page is loaded.
clientmethod processRequest() [ Language = javascript ]
This builds up an abstract model of a request object based on
values entered into the generated form. NOTE that the username and
password have been hard-coded here for speed of testing.
clientmethod processResponse(xhr) [ Language = javascript ]
Local method to just spit out the body of the response object
clientmethod renderRequestForm(idx) [ Language = javascript ]
Generate a basic form for the most common options people are likely to
need when desk checking a REST url Map. For GET requests the options
are fairly limited. For PUT and POST requests, you have the option of entering
text for the body of the request, or selecting a file from disk. If a disk
file is selected, the contents of the text area widget on screen is ignored.
clientmethod renderRoutes(rd) [ Language = javascript ]
Renderer for client-side projection of the URL
clientmethod selectRoute(idx) [ Language = javascript ]
Callback function to highlight the last clicked-upon service and
call out to generate a form
clientmethod setRouting() [ Language = javascript ]
clientmethod submitRequest(r) [ Language = javascript ]
This generic method takes a request profile in the form of a JS object
and initiates a simple HTTP Request.
The request profile may include the any of the following:
url - the resourse to request
method - the method to use, one of GET, PUT, POST or DELETE
user - user name for authentication purposes
passwd - user password for authentication purposes
acceptType - preferred MIME type for the response
contentType - MIME type of request body
body - content of request body
async - flag to indicate request should be made asynchronously
callback - method to when complete (request object will be passed in as sole parameter)
url - the resourse to request
method - the method to use, one of GET, PUT, POST or DELETE
user - user name for authentication purposes
passwd - user password for authentication purposes
acceptType - preferred MIME type for the response
contentType - MIME type of request body
body - content of request body
async - flag to indicate request should be made asynchronously
callback - method to when complete (request object will be passed in as sole parameter)
Inherited Members
Inherited Properties
- %condition
- %import
- %includeFiles
- %page
- %resource
- align
- aux
- backgroundTimerInterval
- cellAlign
- cellSize
- cellStyle
- cellVAlign
- children
- composite
- containerStyle
- cssLevel
- disabled
- dragAndDrop
- dragEnabled
- dropEnabled
- enclosingClass
- enclosingStyle
- error
- groupClass
- groupStyle
- height
- hidden
- hint
- hintClass
- hintStyle
- id
- index
- label
- labelClass
- labelDisabledClass
- labelPosition
- labelStyle
- layout
- name
- onafterdrag
- onbeforedrag
- onclick
- ondrag
- ondrop
- onhide
- onrefresh
- onshow
- onupdate
- parent
- showLabel
- slice
- title
- tuple
- useSVG
- useSoftModals
- valign
- visible
- width
- window
- zenPersistentPopup
Inherited Methods
- %AddChild()
- %AddChildAfter()
- %AddChildBefore()
- %AddComponent()
- %AddImportedComponents()
- %AddToSaveSet()
- %ApplyURLParms()
- %Attr()
- %BindExport()
- %ClassIsLatestVersion()
- %ClassName()
- %ConstructClone()
- %DispatchClassMethod()
- %DispatchGetModified()
- %DispatchGetProperty()
- %DispatchMethod()
- %DispatchSetModified()
- %DispatchSetMultidimProperty()
- %DispatchSetProperty()
- %DrawAutoLogout()
- %DrawClassDefinitions()
- %DrawComponentHTML()
- %DrawHTML()
- %DrawHTMLPage()
- %DrawJSStrings()
- %DrawObjectDefinitions()
- %EnclosingDivId()
- %EndBackgroundMethod()
- %EndScript()
- %Eval()
- %EvalC()
- %Extends()
- %ForceClientRender()
- %GetChildIndex()
- %GetComponent()
- %GetComponentById()
- %GetComponentByName()
- %GetEventHandlers()
- %GetLinks()
- %GetPageName()
- %GetParameter()
- %GetValueById()
- %GetValueByName()
- %GetXMLName()
- %IsA()
- %IsModified()
- %Link()
- %LinkCSS()
- %LinkScript()
- %MakeId()
- %New()
- %NormalizeObject()
- %ObjectModified()
- %OnAddToPageAfter()
- %OnAddToPageBefore()
- %OnBeforeCreatePage()
- %OnCreateApplication()
- %OnCreatePage()
- %OnDetermineCSSLevel()
- %OnDrawEnclosingDiv()
- %OnDrawHTMLBody()
- %OnDrawHTMLHead()
- %OnDrawHTMLMeta()
- %OnDrawObjectProperties()
- %OnFinishBackgroundTask()
- %OnMonitorBackgroundTask()
- %OnMutateChildren()
- %OnObjectSynch()
- %OnPreHTTP()
- %OnSubmit()
- %OnUseSoftModals()
- %OnZENDeserialize()
- %OriginalNamespace()
- %PackageName()
- %QuoteValue()
- %QuoteValueL10N()
- %RemoveChild()
- %RemoveChildren()
- %RemoveComponent()
- %RemoveFromSaveSet()
- %RunBackgroundMethod()
- %Self()
- %SerializeObject()
- %SetBackgroundMethodStatus()
- %SetErrorById()
- %SetErrorByName()
- %SetModified()
- %SetValueById()
- %SetValueByName()
- %SetValuesByName()
- %StartScript()
- %ValidateObject()
- %ZENVersion()
- ConvertParameter()
- Decrypt()
- Encrypt()
- EscapeHTML()
- EscapeURL()
- HyperEventCall()
- HyperEventHead()
- Include()
- InsertHiddenField()
- InsertHiddenFields()
- IsPrivate()
- Link()
- OnHTTPHeader()
- OnPage()
- OnPageError()
- OnPostHTTP()
- OnPostHyperEvent()
- OnPreHTTP()
- OnPreHyperEvent()
- Page()
- QuoteJS()
- RewriteURL()
- ShowError()
- StartTimer()
- StopTimer()
- ThrowError()
- UnescapeHTML()
- UnescapeURL()
- XMLDTD()
- XMLExport()
- XMLExportToStream()
- XMLExportToString()
- XMLNew()
- XMLSchema()
- XMLSchemaNamespace()
- XMLSchemaType()
- addChild()
- addChildAfter()
- addChildBefore()
- cancelPopup()
- childrenMutated()
- correctIELayering()
- createComponent()
- createComponentNS()
- deleteComponent()
- dragFinishHandler()
- dragHandler()
- dragNotifyHandler()
- dragStartHandler()
- dropHandler()
- dropStartHandler()
- endModal()
- exposeComponent()
- findElement()
- fireOnResizeEvent()
- fireOnUnloadEvent()
- fireOnUpdateEvent()
- firePopupAction()
- getChildIndex()
- getComponent()
- getComponentById()
- getEnclosingDiv()
- getHidden()
- getHintElement()
- getLabelElement()
- getOpener()
- getProperty()
- getSettings()
- getType()
- gotoPage()
- invokeSuper()
- isOfType()
- launchPopupWindow()
- makeId()
- onCreate()
- onDelete()
- onDisplayHandler()
- onEndModalHandler()
- onPopupAction()
- onRefreshContents()
- onSerialize()
- onServerMethodCall()
- onServerMethodError()
- onServerMethodReturn()
- onStartModalHandler()
- ondisabledHandler()
- onkeydownHandler()
- onkeyupHandler()
- onlayoutHandler()
- onlogoutHandler()
- onoverlayHandler()
- onresizeHandler()
- onunloadHandler()
- onupdateHandler()
- popupActionHandler()
- refreshContents()
- removeChild()
- render()
- renderContents()
- renderSVG()
- setComponentId()
- setHidden()
- setOverlayMode()
- setProperty()
- setPropertyAll()
- setTraceOption()
- startModal()
- startProgressBar()
- stopProgressBar()