|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectphp.java.servlet.CGIServlet.CGIEnvironment
protected class CGIServlet.CGIEnvironment
Encapsulates the CGI environment and rules to derive that environment from the servlet container and request information.
| Field Summary | |
|---|---|
protected java.lang.String |
command
cgi command to be invoked |
protected javax.servlet.ServletContext |
context
context of the enclosing servlet |
protected java.lang.String |
contextPath
context path of enclosing servlet |
protected java.util.HashMap |
environment
derived cgi environment |
protected java.lang.String |
pathInfo
pathInfo for the current request |
protected java.lang.String |
servletPath
servlet URI of the enclosing servlet |
protected java.lang.String |
webAppRootDir
real file system directory of the enclosing servlet's web app |
protected java.io.File |
workingDirectory
cgi command's desired working directory |
| Constructor Summary | |
|---|---|
protected |
CGIServlet.CGIEnvironment(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
javax.servlet.ServletContext context)
Creates a CGIEnvironment and derives the necessary environment, query parameters, working directory, cgi command, etc. |
| Method Summary | |
|---|---|
protected java.lang.String |
blanksToString(java.lang.String couldBeBlank,
java.lang.String subForBlanks)
Converts blank strings to another string |
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. |
void |
init(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
|
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(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Constructs the CGI environment to be supplied to the invoked CGI script; relies heavliy on Servlet API methods and findCGI |
protected void |
setPathInfo(javax.servlet.http.HttpServletRequest req,
java.util.HashMap envp,
java.lang.String sCGIFullName)
|
protected void |
setupFromContext(javax.servlet.ServletContext context)
Uses the ServletContext to set some CGI variables |
protected void |
setupFromRequest(javax.servlet.http.HttpServletRequest req)
Uses the HttpServletRequest to set most CGI variables |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected javax.servlet.ServletContext context
protected java.lang.String contextPath
protected java.lang.String servletPath
protected java.lang.String pathInfo
protected java.lang.String webAppRootDir
protected java.util.HashMap environment
protected java.lang.String command
protected java.io.File workingDirectory
| Constructor Detail |
|---|
protected CGIServlet.CGIEnvironment(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
javax.servlet.ServletContext context)
req - HttpServletRequest for information provided by
the Servlet APIres - HttpServletResponsecontext - ServletContext for information provided by the
Servlet API| Method Detail |
|---|
public void init(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
protected void setupFromContext(javax.servlet.ServletContext context)
context - ServletContext for information provided by the
Servlet APIprotected void setupFromRequest(javax.servlet.http.HttpServletRequest req)
req - HttpServletRequest for information provided by
the Servlet API
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)
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(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
res - HttpServletResponsereq - HttpServletRequest request associated with the CGI
invokation
protected void setPathInfo(javax.servlet.http.HttpServletRequest req,
java.util.HashMap envp,
java.lang.String sCGIFullName)
protected java.lang.String nullsToBlanks(java.lang.String s)
s - string to be converted if necessary
null
protected 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 string
null
protected 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 string
null or empty ("")
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||