How to Use Server Commands

This section discusses how to use server commands, including how to format them and how to send them to the Corda Server™.

Server Command Format

All server commands begin with the character sequence @_ and are in all caps (e.g., @_FILE, @_PCSCRIPT, and @_JPEG).

Each server command takes either zero or one argument. If a command takes an argument, the argument immediately follows the command. The argument is not in parentheses nor is there a space or any other character between the argument and the command.

For example, the @_FILE server command takes one argument, a file name. If the filename is image_template\image1.itxml, the full server command with the argument would be @_FILEimage1.itxml.

Server Command Strings

Server commands are issued to Corda Server via a server command string.

In a URL or HTTP request, the server command string consists of any number of server commands, joined together in one long, unbroken string. Each command in the string follows the previous without any dividing character (e.g., no commas, semi-colons, etc.). All server command strings end with @_END.

For example, to issue the commands @_DONTCACHE, @_FILEbaritem1, and @_FLASH, use the following command string:

@_DONTCACHE@_FILEbaritem1@_FLASH@_END

In a server command file, white space is disregarded. Put commands on separate lines or on the same line. The entire file is considered to be one server command string.

Note: Commands are processed in the order in which they are received.

Server Commands in HTTP Requests

When issuing server commands to Corda Server from an HTTP request, first enter Corda Server's URL (address and port), followed by a question mark (?) and the server command string. For example, if Corda Server is running at http://cs.mycompany.com:2001, and the server command string is @_JPEG@_FILEexamples/bar.itxml@_PCSCRIPTtextbox.settext(Commodities), an appropriate HTTP request is:

http://cs.mycompany.com:2001/?@_JPEG@_FILEexamples/bar.itxml@_PCSCRIPTtextbox.settext(Commodities)@_END

You can either use this HTTP request as the URL for a Web page (in which case the browser only shows the Corda image) or integrate it in a Web page by making it the source of an image or an object tag. If the HTTP request contains a space or other special character, be sure to URL encode it using Javascript* or some other method. This is necessary because URLs cannot contain spaces or special characters.

Server Commands in Corda Embedder

Most server command functionality is available through the various Corda Embedder APIs.

Occasionally, it may be necessary to use server command functionality that isn't available through the Corda Embedder APIs. To get around this, send server commands directly to Corda Server through the Corda Embedder's extraCTSCommands attribute. The only parameter to this method is a server command string. Use the format described above for the server command strings in HTTP requests, without any URL encoding.

For example, to use the Java* Corda Embedder with a Corda Embedder object named myImage, the following call allows you to use the @_LOADREQUEST server command:

myImage.extraCTSCommands = "@_LOADREQUESTcommands1.txt";

Scheduled Tasks

To use server commands to program scheduled tasks, place the server command string inside the <server_commands> property of the task. For example:

<task_name="nightlybuild"><server_commands>@_SAVEmydoc.pdf@_DOC_LOADmydoc.htm</server_commands></task>

For more information about scheduled tasks, see Scheduling Corda Image Generation.