Chapter 16 Installing CGI

Common Gateway Interface (CGI) defines methods on how web servers interact with external content-generating programs.

CGI support can be implemented by using the servlet class org.apache.catalina.servlets.CGIServlet.

CGI support is disabled by default.

Installing CGI

CGI scripts are used to execute programs to external to the Tomcat JVM.This bypasses the security policy configuration in catalina.policy when running a Java SecurityManager.

Remove the XML comments around the CGI servlet and servlet-mapping configuration in $CATALINA_BASE/conf/web.xml.

Configuring CGI

The following servlet init parameters can be used to configure the behavior of the CGI servlet.

  • cgiPathPrefix – The CGI search path starts at the web application root directory + File.separator + this prefix.

    Default cgiPathPrefix: WEB-INF/cgi

  • debug – This is the debugging detail level for messages logged by this servlet.
  • executable – Use this to run the script.
  • parameterEncoding – This refers to the name of the parameter encoding which is used with the GCI servlet. Default: System.getProperty(“file.encoding”, “UTF-8”).
  • passShellEnvironment – This queries if shell environment variables are passed to the GCI script.

  • Currently 3.01/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
  Flag Inappropriate Content 0 comments