
Copyright 2005 Mort Bay Consulting
<Call name="addContext">
<Arg>/cgi-bin/*</Arg>
<Set name="ResourceBase">/home/jules/www/cgi-bin</Set>
<Set name="ServingDynamicServlets">TRUE</Set>
<Call name="addServlet">
<Arg>Common Gateway Interface</Arg>
<Arg>/</Arg>
<Arg>com.mortbay.Servlet.CGI</Arg>
<Put name="Path">/usr/local/bin:/usr/ucb:/bin:/usr/bin</Put>
</Call>
</Call>
Note that you can use Put name= statements in the jetty.xml file to configure initParams for the CGI servlet, or you can use initParam statements in the web.xml descriptor.
Some useful initParams are:
commandPrefix - may be used to set a prefix to all commands passed to exec. This can be used on systems that need assistance to execute a particular file type. For example on windows this can be set to "perl" so that perl scripts are executed.path - is passed to the exec environment as PATH.
Furthermore, any initParam that starts with ENV_ is interpreted by the CGI servlet as being an environment variable. The leading ENV_ is stripped and the resulting name and value are passed to the exec environment.
On Windows boxes, you may find that you need to set the initParam ENV_SystemRoot to make your script work eg:
<Put name="ENV_SystemRoot">C:/Windows</Put>