Previous: Append Access Authorization| Zot-Dispatch 2.0| Next: ZD-Comments

Zot-Dispatch: Filters

At one point or another you may find that it would be nice to pass the response data from a ZD-Method through an outside program before it is dispatched. This outside program could do something quite simple such as reformatting or adding data, or it might perform side operations that are impossible for Zot-Dispatch to do on its own.

Zot-Dispatch allows you to do just this. In the configuration file it is possible to specify a list of trusted filter programs through which the response data may be sent. Each program in the list has a symbolic name associated with it which can be placed in a ZD-Method element to insruct Zot-Dispatch to use that program.

It isn't difficult to instruct Zot-Dispatch to run response data to a filter. It is done in the Destination field. Simply place at the beginning of the Destination field of any ZD-Method element two vertical bars (|) and place inbetween them the symbolic name of the filter program you want to run the data through. If you want to run it through more than one filter program, list all the symbolic names separated by vertical bars in the order you wish to have them go through the filters. Any information which should normally be kept in the Destination field (e-mail addresses, append file names, direct, etc.) should come after the last vertical bar.

Example:
In this example configuration file I have the following lines to define two filter programs:

  <pipe_programs>
    htmlify = "/some/path/to/the/program/htmlify"
    filter2 = "/some/other/path/to/filter2 -args"
  </pipe_programs>
Now if I want to reflect a user's input, running the output through htmlify first, I would specify my ZD-Method as follows:
  <INPUT TYPE=hidden NAME=ZD-Method 
    VALUE="ZD-Reflect;|htmlify|;body:$usersinput#">
If I want to run it through both of the filters (filter2 first), I would do the following:
  <INPUT TYPE=hidden NAME=ZD-Method 
    VALUE="ZD-Reflect;|filter2|htmlify|;body:$usersinput#">
If I want to run it through both programs but I don't want any substitution to be done on the data, I would do it as follows:
  <INPUT TYPE=hidden NAME=ZD-Method 
    VALUE="ZD-Reflect;|htmlify|filter2|direct;body:$usersinput#">
Notice how the direct comes after the last vertical bar. Anything that comes after the last vertical bar is treated as though it were in the Destination field without the vertical bars and filter program symbolic names. In order to do this most effectively, it is necessary to require that the first and last vertical bars in the Destination field be in that field when the data is submitted, as opposed to having the vertical bars substituted into the field at a later time.

The following would not be interpreted correctly:

  <INPUT TYPE=hidden NAME="filters" VALUE="|htmlify|">
  <INPUT TYPE=hidden NAME="ZD-Method 
    VALUE="ZD-Reflect;$filters#direct;body:$usersinput#">
However this would:
  <INPUT TYPE=hidden NAME="filters" VALUE="htmlify">
  <INPUT TYPE=hidden NAME="ZD-Method 
    VALUE="ZD-Reflect;|$filters#|direct;body:$usersinput#">
If no filters are specified in between the vertical bars, or if there is no filter program corresponding to the symbolic name given, then the response data will go unchanged.

Example

This example will run your input through a filter I'm calling htmlify. It simply looks for anything that looks like an http URL and makes it into a link (It doesn't check to see if there is already a link there). The ZD-Method I'm using looks like the following:
  <INPUT TYPE=hidden NAME=ZD-Method
        VALUE="ZD-Reflect;|htmlify|;body:$input#">
Enter in some text with a URL in it below and press the Submit button.


Previous: Append Access Authorization| Zot-Dispatch 2.0| Next: ZD-Comments
Zot-Dispatch 2.0
Written by Leonard Megliola III (lmegliol@uci.edu)
Last Revised 31 August 1995