org.apache.catalina.util
Class ProcessEnvironment
java.lang.Object
org.apache.catalina.util.ProcessEnvironment
public class ProcessEnvironment
extends java.lang.Object
Encapsulates the Process environment and rules to derive
that environment from the servlet container and request information.
Version:
- Martin Dengler [root@martindengler.com]
- Tomcat 4.0
protected String | command - command to be invoked
|
protected int | debug - the debugging detail level for this instance.
|
protected Hashtable | env - derived process environment
|
protected String | pathInfo - pathInfo for the current request
|
protected boolean | valid - whether or not this object is valid or not
|
protected File | workingDirectory - process' desired working directory
|
ProcessEnvironment(HttpServletRequest req, ServletContext context) - Creates a ProcessEnvironment and derives the necessary environment,
working directory, command, etc.
|
ProcessEnvironment(HttpServletRequest req, ServletContext context, int debug) - Creates a ProcessEnvironment and derives the necessary environment,
working directory, command, etc.
|
protected String | blanksToString(String couldBeBlank, String subForBlanks) - Converts blank strings to another string
|
protected boolean | deriveProcessEnvironment(HttpServletRequest req) - Constructs the Process environment to be supplied to the invoked
process.
|
String | getCommand() - Gets derived command string
|
ServletContext | getContext()
|
String | getContextPath()
|
Hashtable | getEnvironment() - Gets process' environment
|
String | getServletPath()
|
String | getWebAppRootDir() - Gets the root directory of the web application to which this process\
belongs
|
File | getWorkingDirectory() - Gets this process' derived working directory
|
boolean | isValid() - Gets validity status
|
protected void | log(String s)
|
protected String | nullsToBlanks(String s) - Converts null strings to blank strings ("")
|
protected String | nullsToString(String couldBeNull, String subForNulls) - Converts null strings to another string
|
protected String | setCommand(String command) - Sets the desired command string
|
Hashtable | setEnvironment(Hashtable env) - Sets process' environment
|
protected void | setupFromContext(ServletContext context) - Uses the ServletContext to set some process variables
|
protected void | setupFromRequest(HttpServletRequest req) - Uses the HttpServletRequest to set most process variables
|
String | toString() - Print important process environment information in an
easy-to-read HTML table
|
command
protected String command
command to be invoked
debug
protected int debug
the debugging detail level for this instance.
env
protected Hashtable env
derived process environment
pathInfo
protected String pathInfo
pathInfo for the current request
valid
protected boolean valid
whether or not this object is valid or not
workingDirectory
protected File workingDirectory
process' desired working directory
ProcessEnvironment
public ProcessEnvironment(HttpServletRequest req,
ServletContext context)
Creates a ProcessEnvironment and derives the necessary environment,
working directory, command, etc.
req
- HttpServletRequest for information provided by
the Servlet APIcontext
- ServletContext for information provided by
the Servlet API
ProcessEnvironment
public ProcessEnvironment(HttpServletRequest req,
ServletContext context,
int debug)
Creates a ProcessEnvironment and derives the necessary environment,
working directory, command, etc.
req
- HttpServletRequest for information provided by
the Servlet APIcontext
- ServletContext for information provided by
the Servlet APIdebug
- int debug level (0 == none, 4 == medium, 6 == lots)
blanksToString
protected String blanksToString(String couldBeBlank,
String subForBlanks)
Converts blank strings to another string
couldBeBlank
- string to be converted if necessarysubForBlanks
- string to return instead of a blank string
- a non-null string, either the original or the substitute
string if the original was
null
or empty ("")
deriveProcessEnvironment
protected boolean deriveProcessEnvironment(HttpServletRequest req)
Constructs the Process environment to be supplied to the invoked
process. Defines an environment no environment variables.
Should be overriden by subclasses to perform useful setup.
req
- request associated with the
Process' invocation
- true if environment was set OK, false if there was a problem
and no environment was set
getCommand
public String getCommand()
Gets derived command string
- command string
getContext
public ServletContext getContext()
getContextPath
public String getContextPath()
getEnvironment
public Hashtable getEnvironment()
Gets process' environment
- process' environment
getServletPath
public String getServletPath()
getWebAppRootDir
public String getWebAppRootDir()
Gets the root directory of the web application to which this process\
belongs
- root directory
getWorkingDirectory
public File getWorkingDirectory()
Gets this process' derived working directory
- working directory
isValid
public boolean isValid()
Gets validity status
- true if this environment is valid, false otherwise
log
protected void log(String s)
nullsToBlanks
protected String nullsToBlanks(String s)
Converts null strings to blank strings ("")
s
- string to be converted if necessary
- a non-null string, either the original or the empty string
("") if the original was
null
nullsToString
protected String nullsToString(String couldBeNull,
String subForNulls)
Converts null strings to another string
couldBeNull
- string to be converted if necessarysubForNulls
- string to return instead of a null string
- a non-null string, either the original or the substitute
string if the original was
null
setCommand
protected String setCommand(String command)
Sets the desired command string
command
- String command as desired
- command string
setEnvironment
public Hashtable setEnvironment(Hashtable env)
Sets process' environment
env
- process' environment
- Hashtable to which the process' environment was set
setupFromContext
protected void setupFromContext(ServletContext context)
Uses the ServletContext to set some process variables
context
- ServletContext for information provided by
the Servlet API
setupFromRequest
protected void setupFromRequest(HttpServletRequest req)
Uses the HttpServletRequest to set most process variables
req
- HttpServletRequest for information provided by
the Servlet API
toString
public String toString()
Print important process environment information in an
easy-to-read HTML table
- HTML string containing process environment info
Copyright B) 2000-2003 Apache Software Foundation. All Rights Reserved.