protected class CGIServlet.CGIEnvironment
extends java.lang.Object
| Modifier | Constructor and Description |
|---|---|
protected |
CGIEnvironment(HttpServletRequest req,
ServletContext context)
Creates a CGIEnvironment and derives the necessary environment, query parameters, working directory, cgi
command, etc.
|
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.String |
blanksToString(java.lang.String couldBeBlank,
java.lang.String subForBlanks)
Converts blank strings to another string
|
protected void |
expandCGIScript()
Extracts requested resource from web app archive to context work directory to enable CGI script to be
executed.
|
protected java.lang.String[] |
findCGI(java.lang.String pathInfo,
java.lang.String webAppRootDir,
java.lang.String contextPath,
java.lang.String servletPath,
java.lang.String cgiPathPrefix)
Resolves core information about the cgi script.
|
protected java.lang.String |
getCommand()
Gets derived command string
|
protected java.util.Hashtable<java.lang.String,java.lang.String> |
getEnvironment()
Gets derived CGI environment
|
protected java.util.ArrayList<java.lang.String> |
getParameters()
Gets derived CGI query parameters
|
protected java.io.File |
getWorkingDirectory()
Gets derived CGI working directory
|
protected boolean |
isValid()
Gets validity status
|
protected java.lang.String |
nullsToBlanks(java.lang.String s)
Converts null strings to blank strings ("")
|
protected java.lang.String |
nullsToString(java.lang.String couldBeNull,
java.lang.String subForNulls)
Converts null strings to another string
|
protected boolean |
setCGIEnvironment(HttpServletRequest req)
Constructs the CGI environment to be supplied to the invoked CGI script; relies heavily on Servlet API
methods and findCGI
|
protected void |
setupFromContext(ServletContext context)
Uses the ServletContext to set some CGI variables
|
protected boolean |
setupFromRequest(HttpServletRequest req)
Uses the HttpServletRequest to set most CGI variables
|
java.lang.String |
toString()
Returns important CGI environment information in a multi-line text format.
|
protected CGIEnvironment(HttpServletRequest req, ServletContext context) throws java.io.IOException
req - HttpServletRequest for information provided by the Servlet APIcontext - ServletContext for information provided by the Servlet APIjava.io.IOException - an IO error occurredprotected void setupFromContext(ServletContext context)
context - ServletContext for information provided by the Servlet APIprotected boolean setupFromRequest(HttpServletRequest req) throws java.io.UnsupportedEncodingException
req - HttpServletRequest for information provided by the Servlet APIjava.io.UnsupportedEncodingException - Unknown encodingprotected java.lang.String[] findCGI(java.lang.String pathInfo,
java.lang.String webAppRootDir,
java.lang.String contextPath,
java.lang.String servletPath,
java.lang.String cgiPathPrefix)
Example URI:
/servlet/cgigateway/dir1/realCGIscript/pathinfo1
CGI search algorithm: search the real path below <my-webapp-root> and find the first non-directory in the getPathTranslated("/"), reading/searching from left-to-right.
The CGI search path will start at webAppRootDir + File.separator + cgiPathPrefix (or webAppRootDir alone if cgiPathPrefix is null).
cgiPathPrefix is defined by setting this servlet's cgiPathPrefix init parameter
pathInfo - String from HttpServletRequest.getPathInfo()webAppRootDir - String from context.getRealPath("/")contextPath - String as from HttpServletRequest.getContextPath()servletPath - String as from HttpServletRequest.getServletPath()cgiPathPrefix - subdirectory of webAppRootDir below which the web app's CGIs may be stored; can be null.
The CGI search path will start at webAppRootDir + File.separator + cgiPathPrefix (or
webAppRootDir alone if cgiPathPrefix is null). cgiPathPrefix is defined by setting
the servlet's cgiPathPrefix init parameter.path - full file-system path to valid cgi script, or null if no cgi was found
scriptName - CGI variable SCRIPT_NAME; the full URL path to valid cgi script or
null if no cgi was found
cgiName - servlet pathInfo fragment corresponding to the cgi script itself, or
null if not found
name - simple name (no directories) of the cgi script, or null if no cgi was
found
protected boolean setCGIEnvironment(HttpServletRequest req) throws java.io.IOException
req - request associated with the CGI Invocationjava.io.IOException - an IO error occurredprotected void expandCGIScript()
public java.lang.String toString()
toString in class java.lang.Objectprotected java.lang.String getCommand()
protected java.io.File getWorkingDirectory()
protected java.util.Hashtable<java.lang.String,java.lang.String> getEnvironment()
protected java.util.ArrayList<java.lang.String> getParameters()
protected boolean isValid()
protected java.lang.String nullsToBlanks(java.lang.String s)
s - string to be converted if necessarynullprotected java.lang.String nullsToString(java.lang.String couldBeNull,
java.lang.String subForNulls)
couldBeNull - string to be converted if necessarysubForNulls - string to return instead of a null stringnullprotected java.lang.String blanksToString(java.lang.String couldBeBlank,
java.lang.String subForBlanks)
couldBeBlank - string to be converted if necessarysubForBlanks - string to return instead of a blank stringnull
or empty ("")Copyright © 2000-2024 Apache Software Foundation.
Apache Tomcat, Tomcat, Apache, the Apache Tomcat logo and the Apache logo are either registered trademarks or trademarks of the Apache Software Foundation.