sunlabs.brazil.sunlabs
Class FastCgiHandler

java.lang.Object
  extended by sunlabs.brazil.sunlabs.FastCgiHandler (view source)
All Implemented Interfaces:
Handler

public class FastCgiHandler
extends Object
implements Handler

Handler for implementing Fast cgi/1.1 interface. Only the Responder role is implemented.

host:port
Where to send the CGI requests to.
prefix
Url's must match this prefix
suffix
The url must contain this suffix at the end of a path component (e.g. at the end, or before a "/").
root
This is the virtual document root passed to the CGI process. If not supplied, the server's root is used instead, which is likely to be useful only if the CGI process is running on the same machine.
noheaders
If true, then no "http headers" are expected from the server.
env
Lists tokens that represent additional environment variables to pass to the fast fcgi process. They are of the form:
 token1.name=..
 token1.value=..
 ...
 tokenn.name=..
 tokenn.value=..
 
The values are interpreted for ${...} substitutions at each request.
Notes:

FastCGI uses the same "environment" variables that are passed to normal CGI scripts. With CGI, the server finds the script in the filesystem (based on the URL) and runs the script directly. However, with Fast-CGI the "environment" is passed over a socket to an already-running process, which is often on a different machine.

In that case, the environment variables: SCRIPT_FILENAME, SCRIPT_NAME, PATH_INFO and PATH_TRANSLATED don't make sense, as there isn't necessarily a file in the filesystem that corresponds to the URL. FastCGI scripts do rely on them anyway, often "assuming" they are in the filesystem in the same place their CGI cousins would be if they were running on the same machine as the server.

This handler:

  1. If a "suffix" is provided, it finds the first portion of the url path that ends in that suffix, and considers that path element to be the "script".
  2. If a "prefix" is provided, it uses the first complete path element after the prefix as the "script".
  3. If neither the "suffix" nor "prefix" searches yield a virtual script name, the handler ignors the request (returns false).
ToDo: