SK.gnome.dwarf.http.servlet
Class CGIServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
SK.gnome.dwarf.http.servlet.CGIServlet
- All Implemented Interfaces:
- java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
- public class CGIServlet
- extends javax.servlet.http.HttpServlet
This servlet executes the CGI commands.
This servlet implements the Common Gateway Interface (CGI) version 1.1. It may
be mapped to an arbitrary pattern except the default "/" servlet path. It requires one
initial parameter "execDir", which must be an absolute or relative location of
the directory where the CGI executable files will be stored.
Let's say that the CGIServlet is mapped to "/cgi-bin/*" pattern and
the "execDir" initial paramater points to "www/exec" directory. If a client
requests the "/cgi-bin/env.bat" URL, it will be mapped to the "env.bat"
executable file located in the "www/exec" directory, i.e. the full path to the
CGI program will be "www/exec/env.bat".
The servlet thread does not currently wait for the CGI process to finish, therefore
some malicious CGI programs may continue to run even if the request processing has been
finished. Hovewer, if an I/O error occurs while forwarding the output from the CGI program,
the servlet will force the CGI process to exit. This can occur if the remote client
explicitly closes the connection before the complete server response is sent to it.
Remember that if you are going to run the server in a real sandbox, you must grant
the java.io.FilePermission "execDir${/}*", "execute" permission to each
particular directory containing the CGI executables.
- See Also:
- Serialized Form
Method Summary |
protected void |
doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
|
protected void |
doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
|
java.lang.String |
getServletInfo()
|
void |
init()
|
Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doOptions, doPut, doTrace, getLastModified, service, service |
Methods inherited from class javax.servlet.GenericServlet |
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, log, log |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CGIServlet
public CGIServlet()
init
public void init()
throws javax.servlet.ServletException
- Throws:
javax.servlet.ServletException
getServletInfo
public java.lang.String getServletInfo()
doGet
protected void doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws java.io.IOException,
javax.servlet.ServletException
- Throws:
java.io.IOException
javax.servlet.ServletException
doPost
protected void doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws java.io.IOException,
javax.servlet.ServletException
- Throws:
java.io.IOException
javax.servlet.ServletException
Copyright (c) 1999-2005, Gnome Ltd. All rights reserved.