Sun Java System Web Server 7.0 Update 1 Administrator's Configuration File Reference

external

The external function passes a value to an external rewriting program and returns the result.

Each invocation of external results in a single newline-terminated line being written to the external rewriting program's stdin. For each line of input, the program must produce a single line of output. When developing an external rewriting program, it is important to avoid buffering stdout. In Perl, for example, $| = 1; should be used to disable buffering. Because the server expects the external rewriting program to produce one line of output for each line of input, the server can hang if the external rewriting program buffers its output.

Syntax

external(program, value)

Arguments

The expression function has the following arguments.

Table A–8 external Arguments

Argument 

Description 

program

The program argument is the file name of an external rewriting program. Because program is executed using the operating system's default shell (/bin/sh on Unix/Linux) or the command interpreter (CMD.EXE on Windows), program should be an absolute path or the name of a program in the operating system's PATH. The server starts the external rewriting program on demand. A given server process never executes more than one instance of the program at a time.


Note –

The server may start multiple instances of a given external rewriting program when the server is running in multiprocess mode.


value

The value passed to the rewrite program. 

Example

The following is an example of an external rewriting program rewrite.pl, used to change the prefix /home/ to /u/:

#!/usr/bin/perl
$| = 1;
while (<STDIN>) {
    s|^/home/|/u/|;
    print $_;
}

In this example, the external expression function used to invoke rewrite.pl is as follows:

NameTrans fn="rewrite" path="$(external('rewrite.pl', $path))"