protected class CGIServlet.CGIRunner extends Object
run method used to actually invoke the
The CGI environment and settings are derived from the information passed to the constructor.
The input and output streams can be set by the
setResponse methods, respectively.
|Modifier||Constructor and Description|
Creates a CGIRunner and initializes its environment, working directory, and query parameters.
|Modifier and Type||Method and Description|
Converts a Hashtable to a String array by converting each key/value pair in the Hashtable to a String in the form "key=value" (hashkey + "=" + hash.get(hashkey).toString())
Gets ready status
Executes a CGI script with the desired environment, current working directory, and input/output streams This implements the following CGI specification recommedations: Servers SHOULD provide the "
Sets standard input to be passed on to the invoked cgi script
Sets HttpServletResponse object used to set headers and send output to
Checks and sets ready status
protected CGIServlet.CGIRunner(String command, Hashtable<String,String> env, File wd, ArrayList<String> params)
command- string full path to command to be executed
env- Hashtable with the desired script environment
wd- File with the script's desired working directory
params- ArrayList with the script's query command line parameters as strings
protected void updateReadyStatus()
protected boolean isReady()
runwill throw an exception), true if ready
protected void setResponse(HttpServletResponse response)
response- HttpServletResponse to be used
protected void setInput(InputStream stdin)
stdin- InputStream to be used
protected String hashToStringArray(Hashtable<String,?> h) throws NullPointerException
h- Hashtable to convert
NullPointerException- if a hash key has a null value
protected void run() throws IOException
This implements the following CGI specification recommedations:
query" component of the script-URI as command-line arguments to scripts if it does not contain any unencoded "=" characters and the command-line arguments can be generated in an unambiguous manner.
auth-scheme" token of the "
Authorization" if it was supplied as part of the request header. See
." and "
.." path segments: This implementation does not allow "
." and "
.." in the the path, and such characters will result in an IOException being thrown (this should never happen since Tomcat normalises the requestURI before determining the contextPath, servletPath and pathInfo);
IOException- if problems during reading/writing occur
Runtime.exec(String command, String envp, File dir)
Copyright © 2000-2015 Apache Software Foundation. All Rights Reserved.