Skip to main content

This version of the product is no longer supported, and this documentation is no longer updated regularly. See the latest version of this content.Opens in a new tab

REST.DocServer

class REST.DocServer extends %CSP.REST

Provide a REST interface to the document server service This UrlMap maps http requests to the classmethod to which it should be dispatched Example usages. In these examples please replace the host name and port with appropriate values for your situation.
  1. Get the text of the class Samples/Sample.Person

    curl http://localhost:57772/csp/samples/docserver/class/samples/Sample.Person

  2. Get a list of namespaces on the target server (plain/text)

    curl http://localhost:57772/csp/samples/docserver/namespaces

  3. Get a list of namespaces on the target server (jason format)

    curl -H "Accept:application/json" http://localhost:57772/csp/samples/docserver/namespaces

  4. Display the contents of the http request ( shows how to manage cookies) Set the UseSession Parameter to 1 to enable CSP SESSIONS

    curl -v -b cookie.txt -c cookie.txt http://localhost:57772/csp/samples/docserver/request

  5. Echo the contents of a file sent to the server

    curl -v -X POST --data-binary @class.txt --header "Content-Type:text/plain" http://localhost:57772/csp/samples/docserver/echo

  6. Send the contents of a file representing the text of a class definition. Return a JSON encoded set of descriptors which define how the text should be syntax colored.

    curl -v -X POST --data-binary @class.txt --header "Content-Type:text/plain" -H "Accept:application/json" http://localhost:57772/csp/samples/docserver/colorclass

  7. Get a list of embedded languages for syntax coloring:

    curl -H "Accept:application/json" http://localhost:57772/csp/samples/docserver/languages

Method Inventory

Methods

classmethod ColorClass() as %Status
Given the source of a class as the request content (POST) return a representation of the coloring for the class. If the client accepts json, then a json representation is returned as an array. Each element of the array represents a line of source code. The element is itself an array of coloring descriptors. Each descriptor is an object with containing the start (p)osition on the line (zero based), the (c)ount of characters, the (l)anguage index and the (s)ymbol index. If the client does not accept json then the tradicional CSV representation is returned. Example:- Input: class ABC { Property XYZ; } Output: [ [ {"p":0, "c":5, "l":3, "s":4}, {"p":5, "c":1, "l":3, "s":1}, {"p":6, "c":3, "l":3, "s":5} ], [ {"p":0, "c":1, "l":3, "s":8} ], [ {"p":0, "c":4, "l":3, "s":1}, {"p":4, "c":8, "l":3, "s":4}, {"p":12, "c":1, "l":3, "s":1}, {"p":13, "c":3, "l":3, "s":11}, {"p":16, "c":1, "l":3, "s":8} ], [ {"p":0, "c":1, "l":3, "s":8} ] ]
classmethod Echo() as %Status
Return the posted data
classmethod GetClass(pNamespace As %String, pClassname As %String) as %Status
This method returns the class text for the named cache class
classmethod GetColorLanguages() as %Status
This method is used to retrieve a list of languages
classmethod GetNamespaces() as %Status
This method returns a list of namespaces for this server
classmethod Request() as %Status
Return a dump of the request object

Inherited Members

Inherited Methods

FeedbackOpens in a new tab