Using Streaming

HTTP requests to the streaming interface of a CMS application must use one of the HTTP methods POST and GET. A request that is executed with another than these two methods is acknowledged with a response containing the HTTP error code 405 (method not allowed).

Uploads

Data is transferred with a POST request addressed to the /stream URL to a CMS application. For uploading data, the body of the HTTP POST request must contain the data to be transmitted. Keep-Alive is supported.

The application stores the received data in the file system and generates a ticket whose ID is returned to the client. Thus, the body of the HTTP response to the upload request contains the ticket ID only. This response contains the HTTP error code 200 (OK). If, however, an error occurs, the HTTP response does not contain a ticket ID and the HTTP error code 500 is returned (Internal Server Error).

Downloads

All downloads via the streaming interface are HTTP GET requests referring to the ticket ID. Therefore, the URL is formed as shown in the following example (specify your server host name instead of my.cmsserver):

http://my.cmsserver/stream/6528721

In the example above, 6528721 is the ticket ID that could have been requested via CRUL and returned in the response to this request:

<cm-request ...>
  <obj-where>
    <id>37634</id>
  </obj-where>
  <obj-get>
    <blob encoding="stream"/>
  </obj-get>
</cm-request>


<cm-response ...>
  <cm-code numeric="0" phrase="ok">
    <obj>
      <blob encoding="stream">78239162</blob>
    </obj>
  </cm-code>
</cm-response>

Now the blob can be fetched by means of a GET request to the streaming interface of the Content Management Server:

http://my.cm/stream/78239162

If no ticket ID is specified in the download URL or no ticket with the specified ID exists or a ticket which has become invalid is referenced, the HTTP response contains the HTTP error code 404 (Not found). However, if the ticket is valid, the HTTP response contains the HTTP error code 200 (OK) and the body contains the data stored under the ticket. Keep-Alive is also supported here.

Fetching the Output of Custom Commands

Custom commands can be executed by the Content Management Server only. As with downloads, you can fetch the output of such an additional command using streaming by sending a GET request to the server, specifying the ticket ID in the URL. This ID is issued when the custom command is executed. Errors resulting from invalid or missing ticket IDs are handled by the Content Management Server in the same manner as with downloads.

If the ticket is valid, the HTTP response contains the HTTP error code 200 (OK) and in the body the output of the custom command to which the ticket refers can be found. Keep-Alive is not supported for requests like these.

If the output of a custom command is integrated into a web page (as is the case with the GUI of the Content Management Server, the CMS Navigator), this page can be written in such a way that it is updated regularly. By this, the user of the page is kept up to date about the progress of the custom command.

To update a page every 15 seconds, use a meta tag according to the following example:

<meta http-equiv="Refresh" content="15; url=http://my.cm/stream/7891528">