RenderX

Chapter 6 of the IREn InGrid User Guide

Using IREn InGrid in Toaster mode

Toaster is one of the parts of IREn InGrid which requires to be integrated into the customer's business process by writing a client program. Since Toaster accepts requests over a network TCP socket, and implements a simple protocol, you must implement the protocol in your language of choice and embed it in your client-side application, such as a Web form, or an authoring tool.

IREn InGrid distribution includes an example client application. It is written as a CGI script and Python. It contains a sample Web page ${instDir}/etc/toaster.html which contains an HTTP form. A user attaches an XSL-FO document and submits the form to a ${instDir}/etc/wet.cgi script which, in turn, calls the Toaster to format the document. Additionally, examples of Java Server Pages and ASP.NET are included into the distribution.

Before using IREn InGrid in Toaster mode, it must be configured accordingly. See Chapter 3 for further details.

Setting up Toaster with a simple Web Server

Abstract

The standard distribution of IREn InGrid contains a sample configuration for a simple Web-service setup.

  1. Copy the file InGrid/etc/wet.cgi to the Web server's working directory.

  2. Copy InGrid/etc/toaster.***.example to the Web server's working directory.

    Note: Note. The format of example page depends on the specific Web server.

  3. If necessary, change path to Python interpreter by editing wet.cgi and changing the path in the topmost line.

  4. If the Toaster service is supposed to run on another machine, also specify its address and port in the line:

    TOASTER = ...
    
  5. Start the web server and test whether it is working by formatting any FO document.

6.1. Connecting to Toaster

The protocol involves one request and one response. The client sends the request, in the form as follows:

RECEIVE data-size systemId

followed by a zero byte ('\0' in C), and then by the data of data-size bytes in length itself. Toaster transforms the document into PDF or PostScript and returns it: it sends

RECEIVE data-size format

followed by a zero byte and by the formatted document.

If IREn InGrid is unable to format the document, it sends

ERROR message-size None

followed by a zero byte and then by the error message. The message contains IREn's diagnostics and helps identify the problem.

To shutdown Toaster, send message STOP to the data port.