public class ProcessEnvironment extends Object
Modifier and Type | Field and Description |
---|---|
protected String |
command
command to be invoked
|
protected int |
debug
the debugging detail level for this instance.
|
protected Hashtable<String,String> |
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
|
Constructor and Description |
---|
ProcessEnvironment(javax.servlet.http.HttpServletRequest req,
javax.servlet.ServletContext context)
Creates a ProcessEnvironment and derives the necessary environment,
working directory, command, etc.
|
ProcessEnvironment(javax.servlet.http.HttpServletRequest req,
javax.servlet.ServletContext context,
int debug)
Creates a ProcessEnvironment and derives the necessary environment,
working directory, command, etc.
|
Modifier and Type | Method and Description |
---|---|
protected String |
blanksToString(String couldBeBlank,
String subForBlanks)
Converts blank strings to another string
|
protected boolean |
deriveProcessEnvironment(javax.servlet.http.HttpServletRequest req)
Constructs the Process environment to be supplied to the invoked
process.
|
String |
getCommand()
Gets derived command string
|
javax.servlet.ServletContext |
getContext() |
String |
getContextPath() |
Hashtable<String,String> |
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<String,String> |
setEnvironment(Hashtable<String,String> env)
Sets process' environment
|
protected void |
setupFromContext(javax.servlet.ServletContext context)
Uses the ServletContext to set some process variables
|
protected void |
setupFromRequest(javax.servlet.http.HttpServletRequest req)
Uses the HttpServletRequest to set most process variables
|
String |
toString()
Print important process environment information in an
easy-to-read HTML table
|
protected String pathInfo
protected String command
protected boolean valid
protected int debug
protected File workingDirectory
public ProcessEnvironment(javax.servlet.http.HttpServletRequest req, javax.servlet.ServletContext context)
req
- HttpServletRequest for information provided by
the Servlet APIcontext
- ServletContext for information provided by
the Servlet APIpublic ProcessEnvironment(javax.servlet.http.HttpServletRequest req, javax.servlet.ServletContext context, int debug)
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)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 APIpublic String toString()
public String getCommand()
protected String setCommand(String command)
command
- string as desiredpublic File getWorkingDirectory()
public Hashtable<String,String> getEnvironment()
public Hashtable<String,String> setEnvironment(Hashtable<String,String> env)
env
- process' environmentpublic boolean isValid()
protected String nullsToBlanks(String s)
s
- string to be converted if necessarynull
protected String nullsToString(String couldBeNull, String subForNulls)
couldBeNull
- string to be converted if necessarysubForNulls
- string to return instead of a null stringnull
protected String blanksToString(String couldBeBlank, String subForBlanks)
couldBeBlank
- string to be converted if necessarysubForBlanks
- string to return instead of a blank stringnull
or empty ("")protected void log(String s)
protected boolean deriveProcessEnvironment(javax.servlet.http.HttpServletRequest req)
Should be overriden by subclasses to perform useful setup.
req
- HttpServletRequest request associated with the
Process' invocationpublic String getWebAppRootDir()
public String getContextPath()
public javax.servlet.ServletContext getContext()
public String getServletPath()
Copyright © 2019. All rights reserved.