com.ibm.wbi.http.beans
Class CgiGenerator

com.ibm.wbi.plugin.Meg
  |
  +--com.ibm.wbi.plugin.Generator
        |
        +--com.ibm.wbi.http.plugin.HttpGenerator
              |
              +--com.ibm.wbi.http.beans.CgiGenerator

public class CgiGenerator
extends HttpGenerator

This class wraps a CGI executable by launching a new process and setting the CGI/1.1 environment variables. It starts the specified executable, routing standard input and standard output as appropriate.


Field Summary
protected  java.lang.String executable
          name of the CGI executable
protected  java.lang.String translatedPath
          the translated path that is sent to the CGI in the PATH_TRANSLATED environment variable
 
Fields inherited from class com.ibm.wbi.http.plugin.HttpGenerator
COPYRIGHT, http
 
Fields inherited from class com.ibm.wbi.plugin.Generator
COPYRIGHT
 
Fields inherited from class com.ibm.wbi.plugin.Meg
COPYRIGHT, EDITOR, GENERATOR, MONITOR, REQUEST_EDITOR, UNDEFINED
 
Constructor Summary
CgiGenerator()
          Construct a new CGI Generator
CgiGenerator(java.lang.String executable)
          Construct a new CGI Generator and specify the name of the CGI executable.
CgiGenerator(java.lang.String executable, java.lang.String translatedPath)
          Construct a new CGI Generator and specify the name of the CGI executable and translated path property.
 
Method Summary
 java.lang.String getExecutable()
          get the executable that will be run when the CGI is accessed.
 java.lang.String getTranslatedPath()
          get the translated path.
 void handleRequest(RequestEvent e)
          handle the request by starting up a process with the appropriate environment variables, launching the CGI executable, and routing standard input and standard output as appropriate.
 void setExecutable(java.lang.String executable)
          set the executable that will be run when the CGI is accessed.
 void setTranslatedPath(java.lang.String translatedPath)
          set the translated path that will be passed to the CGI executable through the PATH_TRANSLATED environment variable.
 
Methods inherited from class com.ibm.wbi.http.plugin.HttpGenerator
add, addCookie, getContentType, getHttpResponse, getHttpResponseString, getResponseCode, getResponseText, isCache, produceHeader, set, setCache, setContentLength, setContentType, setResponseCode, setResponseText, setServer, writeHeader
 
Methods inherited from class com.ibm.wbi.plugin.Generator
getMegType
 
Methods inherited from class com.ibm.wbi.plugin.Meg
forwardRequest, getCondition, getEnabled, getName, getPlugin, getPriority, isEnabled, processRejectedRequest, setCondition, setEnabled, setName, setPriority, setup, setup, setup, setup, threadManagerRun
 

Field Detail

executable

protected java.lang.String executable
name of the CGI executable

translatedPath

protected java.lang.String translatedPath
the translated path that is sent to the CGI in the PATH_TRANSLATED environment variable
Constructor Detail

CgiGenerator

public CgiGenerator()
Construct a new CGI Generator

CgiGenerator

public CgiGenerator(java.lang.String executable)
Construct a new CGI Generator and specify the name of the CGI executable. The translated path property is set to "".

CgiGenerator

public CgiGenerator(java.lang.String executable,
                    java.lang.String translatedPath)
Construct a new CGI Generator and specify the name of the CGI executable and translated path property.
Method Detail

setExecutable

public void setExecutable(java.lang.String executable)
set the executable that will be run when the CGI is accessed. This should be an absolute path to the executable.
Parameters:
executable - the executable to be run

getExecutable

public java.lang.String getExecutable()
get the executable that will be run when the CGI is accessed.
Returns:
the executable to be run

setTranslatedPath

public void setTranslatedPath(java.lang.String translatedPath)
set the translated path that will be passed to the CGI executable through the PATH_TRANSLATED environment variable. This normally refers to a local filename, which could refer to the executable or may be the input for an interpreter.
Parameters:
translatedPath - the translated path

getTranslatedPath

public java.lang.String getTranslatedPath()
get the translated path.
Returns:
the translated path

handleRequest

public void handleRequest(RequestEvent e)
                   throws RequestRejectedException,
                          java.io.IOException
handle the request by starting up a process with the appropriate environment variables, launching the CGI executable, and routing standard input and standard output as appropriate.
Overrides:
handleRequest in class HttpGenerator