com.cometway.httpd
Class HTTPcgi
java.lang.Object
com.cometway.props.Props
com.cometway.ak.Agent
com.cometway.ak.ServiceAgent
com.cometway.httpd.WebServerExtension
com.cometway.httpd.HTTPcgi
- All Implemented Interfaces:
- AgentInterface, HasStateMachineModel
public class HTTPcgi
- extends WebServerExtension
This extension is used to define and execute CGI scripts. It requires a directory
where the script(s) resides as well as a URI for accessing the script. If an attempt
to access just the script directory is made, a 403 Forbidden response is given. Scripts
are executed via a PooledThread with a timeout, if the script doesn't finish running,
the process is killed. This extension requires the inet address methods flag to be set
to true in the WebServer or else some scripts that depend on the client's IP address
may break. This extension currently does NOT support local redirects.
| Fields inherited from class com.cometway.ak.Agent |
agent_id, agentController, CREATING_STATE, debugReporter, DESTROYED_STATE, DESTROYING_STATE, errorReporter, FAILED_STATE, printlnReporter, props, RUNNING_STATE, STARTING_STATE, STOPPED_STATE, STOPPING_STATE, warningReporter |
|
Method Summary |
protected java.lang.String[] |
generateEnvironmentVariables(HTTPAgentRequest request,
java.lang.String scriptName,
java.lang.String scriptPath,
java.lang.String getParams)
|
boolean |
handleRequest(HTTPAgentRequest request)
This will be called by the WebServer (specifically the ConnectionKMethod) to handle
an HTTPAgentRequest. |
void |
initProps()
max_exec_time_ms - The longest time to wait for a script to run before it is killed and an error returned (default: 10000)
script_uri - The URI path to access the script(s) (default: /cgi-bin/)
script_directory - The location of the script(s) on the local filesystem (default: ./html/cgi-bin/)
scripts - a comma separated list of scripts or * for everything in the script_directory (default: *)
thread_pool_size - Maximum number of threads in the thread pool (default: 20)
server_name - The SERVER_NAME to pass to the script. |
protected boolean |
processCGIOutput(HTTPAgentRequest request,
java.lang.StringBuffer out)
|
void |
start()
This method inherited from com.cometway.ak.ServiceAgent includes functionality to
register itself with the WebServer (temporary). |
void |
stop()
Unregisters this instance with the service manager using the service_name property. |
| Methods inherited from class com.cometway.ak.Agent |
currentStateEquals, debug, destroy, error, error, getAgentController, getDateTimeStr, getProps, getServiceImpl, getStateMachineModel, println, register, registerService, setAgentController, setProps, toString, unregister, unregisterService, warning, warning |
| Methods inherited from class com.cometway.props.Props |
addListener, append, copy, copyFrom, copyTo, decrementInteger, dump, enableListeners, enumerateKeys, format, getBoolean, getByteArray, getCharacter, getDate, getDate, getDateString, getDouble, getFloat, getHexString, getInteger, getKeys, getLong, getNextKey, getProperty, getProperty, getPropsContainer, getSize, getString, getString, getTokens, getTokens, getTrimmedString, getVector, hasProperty, incrementInteger, insertProps, loadProps, notifyPropsChanged, notifyPropsChangedIgnore, notifyPropsChangedIgnore, parse, propertyMatchesRegEx, readFromFile, regExPropertyMatches, removeAll, removeListener, removeProperty, resumeNotify, saveProps, set, setBoolean, setCharacter, setDefault, setDouble, setFloat, setInteger, setLong, setProperty, setProperty, setProperty, setPropsContainer, suspendNotify, writeToFile |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
HTTPcgi
public HTTPcgi()
initProps
public void initProps()
- max_exec_time_ms - The longest time to wait for a script to run before it is killed and an error returned (default: 10000)
script_uri - The URI path to access the script(s) (default: /cgi-bin/)
script_directory - The location of the script(s) on the local filesystem (default: ./html/cgi-bin/)
scripts - a comma separated list of scripts or * for everything in the script_directory (default: *)
thread_pool_size - Maximum number of threads in the thread pool (default: 20)
server_name - The SERVER_NAME to pass to the script. This is either a hostname or IP address (default: 127.0.0.1)
server_port - The SERVER_PORT to pass to the script. (default: 80)
server_root_path - This is required for path translation, it is the location of the root HTML directory (default: ./html)
- Specified by:
initProps in interface AgentInterface- Overrides:
initProps in class Agent
start
public void start()
- Description copied from class:
WebServerExtension
- This method inherited from com.cometway.ak.ServiceAgent includes functionality to
register itself with the WebServer (temporary).
- Specified by:
start in interface AgentInterface- Overrides:
start in class WebServerExtension
stop
public void stop()
- Description copied from class:
ServiceAgent
- Unregisters this instance with the service manager using the service_name property.
- Specified by:
stop in interface AgentInterface- Overrides:
stop in class ServiceAgent
handleRequest
public boolean handleRequest(HTTPAgentRequest request)
- Description copied from class:
WebServerExtension
- This will be called by the WebServer (specifically the ConnectionKMethod) to handle
an HTTPAgentRequest. If the request has been handled, true is returned and no other
WebServerExtensions will be used.
- Overrides:
handleRequest in class WebServerExtension
generateEnvironmentVariables
protected java.lang.String[] generateEnvironmentVariables(HTTPAgentRequest request,
java.lang.String scriptName,
java.lang.String scriptPath,
java.lang.String getParams)
processCGIOutput
protected boolean processCGIOutput(HTTPAgentRequest request,
java.lang.StringBuffer out)