These files are also available using standard HTTP GET requests under the server URL, typically of the form http://machine.name/clarens/. This is summarized in table 4.1.
|/||Index file to display 'shell' of different services|
|/web||Files that make up the navigation panel and system-provided content|
|/web/registry||Registry files used to generate navigation panel|
|/web/images||System-provided image files|
|/web/images||System-provided stylesheet files|
These files are in the form of JSONRPC response methods as if generated by web service calls. They are text files that can be created with any text editor, or automatically using a scripting language like Python.
Each registry file may describe one or more service interfaces, with an associated category, name, description and a link to the interface HTML page. In the registry file these properties are as follows:
|name||Short name to be displayed in the menu|
|desc||Longer description to be displyed as a 'tooltip'|
|cat||A category to place the item in|
|file||A relative link to the interface HTML file|
The file containing these definitions must have the .json extension to be used in the navigation menu.
As an example, let's create a registry file for a test service, with a user interface in /web/test:
The result element contains a list of mappings, in this case only one, each with the information needed to describe one menu item.
This page does a few things:
First the value of the word form element is obtained, followed by a call to the jsonrpc method provided by the Clarens framework.
The jsonrpc method takes the following arguments:
|string||method||The name of the remote method|
|list||arguments||A list of arguments|
|function||success callback||Function to be called upon success|
|function||fault callback||Function to be called when a fault is returned|
The arguments to the remote method is usually passed as a list, although in our example we passed a single string as an argument. The success callback, named echo_callback in the example, takes a result object as its only argument. The type of the result object is determined by the remote method.
The fault callback is called with the full JSONRPC result object as was demonstrated in section 4.1.3 for the registry files. In the case of a fault, or exception, returned by the server, the error element of the JSONRPC return object will contain information about the fault, while the result element will be set to null.