public class CGI
extends javax.servlet.http.HttpServlet
The following init parameters are used to configure this servlet:
Modifier and Type | Class and Description |
---|---|
private static class |
CGI.EnvList
private utility class that manages the Environment passed to exec.
|
Modifier and Type | Field and Description |
---|---|
private boolean |
_cgiBinProvided |
private java.lang.String |
_cmdPrefix |
private java.io.File |
_docRoot |
private CGI.EnvList |
_env |
private boolean |
_ignoreExitState |
private boolean |
_ok |
private java.lang.String |
_path |
private boolean |
_relative |
private boolean |
_useFullPath |
private static Logger |
LOG |
private static long |
serialVersionUID |
Constructor and Description |
---|
CGI() |
Modifier and Type | Method and Description |
---|---|
private void |
exec(java.io.File command,
java.lang.String pathInfo,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
executes the CGI process
|
private static java.lang.String |
getTextLineFromStream(java.io.InputStream is)
Utility method to get a line of text from the input stream.
|
void |
init() |
void |
service(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res) |
private static void |
writeProcessInput(java.lang.Process p,
java.io.InputStream input,
int len) |
private static void |
writeProcessInput(java.lang.Process p,
java.lang.String input) |
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
private static final long serialVersionUID
private static final Logger LOG
private boolean _ok
private java.io.File _docRoot
private boolean _cgiBinProvided
private java.lang.String _path
private java.lang.String _cmdPrefix
private boolean _useFullPath
private CGI.EnvList _env
private boolean _ignoreExitState
private boolean _relative
public void init() throws javax.servlet.ServletException
init
in class javax.servlet.GenericServlet
javax.servlet.ServletException
public void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws javax.servlet.ServletException, java.io.IOException
service
in class javax.servlet.http.HttpServlet
javax.servlet.ServletException
java.io.IOException
private void exec(java.io.File command, java.lang.String pathInfo, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws java.io.IOException
command
- the command to execute, this command is prefixed by
the context parameter "commandPrefix".pathInfo
- The PATH_INFO to process,
see http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletRequest.html#getPathInfo%28%29. Cannot be nullreq
- the HTTP requestres
- the HTTP responsejava.io.IOException
- if the execution of the CGI process throwsprivate static void writeProcessInput(java.lang.Process p, java.lang.String input)
private static void writeProcessInput(java.lang.Process p, java.io.InputStream input, int len)
private static java.lang.String getTextLineFromStream(java.io.InputStream is) throws java.io.IOException
is
- the input streamjava.io.IOException
- if reading from the input stream throws