[66] | 1 | <html><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Apache Tomcat 6.0 - CGI How To</title><meta value="Glenn L. Nielsen" name="author"><meta value="glenn@apache.org" name="email"></head><body vlink="#525D76" alink="#525D76" link="#525D76" text="#000000" bgcolor="#ffffff"><table cellspacing="0" width="100%" border="0"><!--PAGE HEADER--><tr><td><!--PROJECT LOGO--><a href="http://tomcat.apache.org/"><img border="0" alt=" |
---|
| 2 | The Apache Tomcat Servlet/JSP Container |
---|
| 3 | " align="right" src="./../images/tomcat.gif"></a></td><td><font face="arial,helvetica,sanserif"><h1>Apache Tomcat 6.0</h1></font></td><td><!--APACHE LOGO--><a href="http://www.apache.org/"><img border="0" alt="Apache Logo" align="right" src="./../images/asf-logo.gif"></a></td></tr></table><table cellspacing="4" width="100%" border="0"><!--HEADER SEPARATOR--><tr><td colspan="2"><hr size="1" noshade></td></tr><tr><!--RIGHT SIDE MAIN BODY--><td align="left" valign="top" width="80%"><table cellspacing="4" width="100%" border="0"><tr><td valign="top" align="left"><h1>Apache Tomcat 6.0</h1><h2>CGI How To</h2></td><td nowrap="true" valign="top" align="right"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Introduction"><strong>Introduction</strong></a></font></td></tr><tr><td><blockquote> |
---|
| 4 | |
---|
| 5 | <p>The CGI (Common Gateway Interface) defines a way for a web server to |
---|
| 6 | interact with external content-generating programs, which are often |
---|
| 7 | referred to as CGI programs or CGI scripts. |
---|
| 8 | </p> |
---|
| 9 | |
---|
| 10 | <p>Within Tomcat, CGI support can be added when you are using Tomcat as your |
---|
| 11 | HTTP server and require CGI support. Typically this is done |
---|
| 12 | during development when you don't want to run a web server like |
---|
| 13 | Apache httpd. |
---|
| 14 | Tomcat's CGI support is largely compatible with Apache httpd's, |
---|
| 15 | but there are some limitations (e.g., only one cgi-bin directory). |
---|
| 16 | </p> |
---|
| 17 | |
---|
| 18 | <p>CGI support is implemented using the servlet class |
---|
| 19 | <code>org.apache.catalina.servlets.CGIServlet</code>. Traditionally, |
---|
| 20 | this servlet is mapped to the URL pattern "/cgi-bin/*".</p> |
---|
| 21 | |
---|
| 22 | <p>By default CGI support is disabled in Tomcat.</p> |
---|
| 23 | </blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Installation"><strong>Installation</strong></a></font></td></tr><tr><td><blockquote> |
---|
| 24 | |
---|
| 25 | <p><strong>CAUTION</strong> - CGI scripts are used to execute programs |
---|
| 26 | external to the Tomcat JVM. If you are using the Java SecurityManager this |
---|
| 27 | will bypass your security policy configuration in <code>catalina.policy.</code></p> |
---|
| 28 | |
---|
| 29 | <p>Remove the XML comments from around the CGI servlet and servlet-mapping |
---|
| 30 | configuration in <code>$CATALINA_BASE/conf/web.xml</code>.</p> |
---|
| 31 | </blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Configuration"><strong>Configuration</strong></a></font></td></tr><tr><td><blockquote> |
---|
| 32 | |
---|
| 33 | <p>There are several servlet init parameters which can be used to |
---|
| 34 | configure the behaviour of the CGI servlet. |
---|
| 35 | <ul> |
---|
| 36 | <li><strong>cgiPathPrefix</strong> - The CGI search path will start at |
---|
| 37 | the web application root directory + File.separator + this prefix. |
---|
| 38 | The default cgiPathPrefix is <code>WEB-INF/cgi</code></li> |
---|
| 39 | <li><strong>debug</strong> - Debugging detail level for messages logged |
---|
| 40 | by this servlet. Default 0.</li> |
---|
| 41 | <li><strong>executable</strong> - The of the executable to be used to |
---|
| 42 | run the script. Default is <code>perl</code>.</li> |
---|
| 43 | <li><strong>parameterEncoding</strong> - Name of the parameter encoding |
---|
| 44 | to be used with the GCI servlet. Default is |
---|
| 45 | <code>System.getProperty("file.encoding","UTF-8")</code>.</li> |
---|
| 46 | <li><strong>passShellEnvironment</strong> - Should the shell environment |
---|
| 47 | variables (if any) be passed to the CGI script? Default is |
---|
| 48 | <code>false</code>.</li> |
---|
| 49 | </ul> |
---|
| 50 | </p> |
---|
| 51 | |
---|
| 52 | </blockquote></td></tr></table></td></tr><!--FOOTER SEPARATOR--><tr><td colspan="2"><hr size="1" noshade></td></tr><!--PAGE FOOTER--><tr><td colspan="2"><div align="center"><font size="-1" color="#525D76"><em> |
---|
| 53 | Copyright © 1999-2008, Apache Software Foundation |
---|
| 54 | </em></font></div></td></tr></table></body></html> |
---|