| career | drupal | java | mac | mysql | perl | scala | uml | unix  

Tomcat example source code file (cgi-howto.xml)

This example Tomcat source code file (cgi-howto.xml) is included in the "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Tomcat tags/keywords

apache, apache, asf, cgi, cgi, default, license, license, see, system, the, the, tomcat, you

The Tomcat cgi-howto.xml source code

<?xml version="1.0"?>
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  See the License for the specific language governing permissions and
  limitations under the License.
<!DOCTYPE document [
  <!ENTITY project SYSTEM "project.xml">
<document url="cgi-howto.html">


        <author email="">Glenn L. Nielsen
        <title>CGI How To


<section name="Introduction">

<p>The CGI (Common Gateway Interface) defines a way for a web server to
interact with external content-generating programs, which are often
referred to as CGI programs or CGI scripts.

<p>Within Tomcat, CGI support can be added when you are using Tomcat as your
HTTP server and require CGI support.  Typically this is done
during development when you don't want to run a web server like 
Apache httpd.
Tomcat's CGI support is largely compatible with Apache httpd's, 
but there are some limitations (e.g., only one cgi-bin directory).

<p>CGI support is implemented using the servlet class
<code>org.apache.catalina.servlets.CGIServlet.  Traditionally,
this servlet is mapped to the URL pattern "/cgi-bin/*".</p>

<p>By default CGI support is disabled in Tomcat.

</section> <section name="Installation"> <p>CAUTION - CGI scripts are used to execute programs external to the Tomcat JVM. If you are using the Java SecurityManager this will bypass your security policy configuration in <code>catalina.policy.

<p>Remove the XML comments from around the CGI servlet and servlet-mapping configuration in <code>$CATALINA_BASE/conf/web.xml.

</section> <p>Only Contexts which are marked as privileged may use the CGI servlet (see the privileged property of the Context element).</p> <section name="Configuration"> <p>There are several servlet init parameters which can be used to configure the behaviour of the CGI servlet. <ul> <li>cgiPathPrefix - The CGI search path will start at the web application root directory + File.separator + this prefix. The default cgiPathPrefix is <code>WEB-INF/cgi <li>debug - Debugging detail level for messages logged by this servlet. Default 0.</li> <li>executable - The of the executable to be used to run the script. Default is <code>perl. <li>parameterEncoding - Name of the parameter encoding to be used with the GCI servlet. Default is <code>System.getProperty("file.encoding","UTF-8"). <li>passShellEnvironment - Should the shell environment variables (if any) be passed to the CGI script? Default is <code>false. </ul> </p> </section> </body> </document>

Other Tomcat examples (source code examples)

Here is a short list of links related to this Tomcat cgi-howto.xml source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller


new blog posts


Copyright 1998-2021 Alvin Alexander,
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.