com.ibm.wbi.protocol.http.beans
Class MultipleCgiGenerator

com.ibm.wbi.Meg
  |
  +--com.ibm.wbi.Generator
        |
        +--com.ibm.wbi.protocol.http.HttpGenerator
              |
              +--com.ibm.wbi.protocol.http.beans.MultipleCgiGenerator

public class MultipleCgiGenerator
extends HttpGenerator

This Generator launches any of the requested CGIs from a directory, or one of its subdirectories. It has four properties: Directory, UrlPrefix, ExecutablePrefix, and ExecutableSuffix. The Directory property specifies the root directory of the local filesystem in which the served files can be found. The UrlPrefix property specifies a path prefix that will be expected to be part of the requested URL that should be ignored. For example, if the Directory is "c:\cgi" and the UrlPrefix is "home/data" and the requested URL is: "http://myserver/home/data/foo/bar.pl" then the Generator will resolve to the file "c:\cgi\foo\bar.pl". The ExecutablePrefix and ExecutableSuffix properties are used to specify additions to the CGI filename. For example, launching a Perl CGI under Windows might require a ExecutablePrefix of "d:\\perl\\bin\\perl.exe ". (Note the trailing space to force a space between the prefix and the executable name).


Fields inherited from class com.ibm.wbi.protocol.http.HttpGenerator
COPYRIGHT, http
 
Fields inherited from class com.ibm.wbi.Meg
EDITOR, GENERATOR, MONITOR, REQUEST_EDITOR, UNDEFINED
 
Constructor Summary
MultipleCgiGenerator()
          the default constructor.
 
Method Summary
 java.lang.String getDirectory()
          Access the Directory property.
 java.lang.String getExecutablePrefix()
          Access the ExecutablePrefix property.
 java.lang.String getExecutableSuffix()
          Access the ExecutableSuffix property.
 java.lang.String getUrlPrefix()
          Access the UrlPrefix property.
 void handleRequest(RequestEvent e)
          Method used by WBI to execute the CGI.
 void setDirectory(java.lang.String d)
          Set the directory property.
 void setExecutablePrefix(java.lang.String ep)
          Set the ExecutablePrefix property.
 void setExecutableSuffix(java.lang.String es)
          Set the ExecutableSuffix property.
 void setUrlPrefix(java.lang.String up)
          Set the UrlPrefix property.
 
Methods inherited from class com.ibm.wbi.protocol.http.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.Generator
getType
 
Methods inherited from class com.ibm.wbi.Meg
forwardRequest, getCondition, getEnabled, getMegProperty, getMegProperty, getMegPropertyKeys, getName, getPlugin, getPriority, getSystemContext, initialize, initialize, isEnabled, isMegApplicable, loadMegResources, run, setCondition, setEnabled, setMegProperty, setName, setPriority, setSystemContext, setup, setup, setup, setup
 

Constructor Detail

MultipleCgiGenerator

public MultipleCgiGenerator()
the default constructor. ExecutablePrefix, ExecutableSuffix, UrlPrefix, and Directory default to "".
Method Detail

setDirectory

public void setDirectory(java.lang.String d)
Set the directory property.
Parameters:
d - String specifying the directory on the local file system in which the files to be served can be found.

getDirectory

public java.lang.String getDirectory()
Access the Directory property.
Returns:
Directory on the local filesystem in which the files to be served can be found.

setUrlPrefix

public void setUrlPrefix(java.lang.String up)
Set the UrlPrefix property. This property specifies what leading characters of the URL path should be ignored when determining where to retrieve the file from the server filesystem. For example, if urlPrefix=="/wbi" and directory=="../data" and the URL Path="/wbi/foo/bar.baz" then the file "bar.baz" will be read from the "../data/foo" directory.
Parameters:
up - the UrlPrefix

getUrlPrefix

public java.lang.String getUrlPrefix()
Access the UrlPrefix property.
Returns:
the UrlPrefix

setExecutablePrefix

public void setExecutablePrefix(java.lang.String ep)
Set the ExecutablePrefix property. This property specifies what leading characters should be added to the executable name when launching the CGI process.
Parameters:
ep - the ExecutablePrefix

getExecutablePrefix

public java.lang.String getExecutablePrefix()
Access the ExecutablePrefix property.
Returns:
the ExecutablePrefix

setExecutableSuffix

public void setExecutableSuffix(java.lang.String es)
Set the ExecutableSuffix property. This property specifies what trailing characters should be added to the executable name when launching the CGI process.
Parameters:
ep - the ExecutableSuffix

getExecutableSuffix

public java.lang.String getExecutableSuffix()
Access the ExecutableSuffix property.
Returns:
the ExecutableSuffix

handleRequest

public void handleRequest(RequestEvent e)
                   throws RequestRejectedException,
                          java.io.IOException
Method used by WBI to execute the CGI.
Overrides:
handleRequest in class HttpGenerator
Parameters:
e - Request event object.
Throws:
COM.ibm.iawbi.almaden.megBean.RequestRejectedException - is thrown if the request contains ".." in its path, or if the requested file does not exist.