Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

CGI

Kelly, Steve

2005-02-18

Replies:

Hi,

Is the following consistent with how CGI perl scripts should execute
under a tomcat webapp?

I have a webapp called mywebapp and a perl script called myperl
The web.xml file contains the following:

   <servlet>
    <servlet-name>cgi</servlet-name>

<servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
    <init-param>
      <param-name>clientInputTimeout</param-name>
      <param-value>100</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>6</param-value>
    </init-param>
    <init-param>
      <param-name>executable</param-name>
      <param-value>perl</param-value>
    </init-param>
    <init-param>
      <param-name>cgiPathPrefix</param-name>
      <param-value>WEB-INF/cgi</param-value>
    </init-param>
     <load-on-startup>5</load-on-startup>
  </servlet>
     
and

  <servlet-mapping>
    <servlet-name>cgi</servlet-name>
    <url-pattern>/cgi-bin/*</url-pattern>
  </servlet-mapping>

If I enter the url //localhost:8080/mywebapp/WEB-INF/cgi/myperl I get a
"resource unavailable" error.
If I enter the url //localhost:8080/mywebapp/cgi-bin/myperl it executes
the myperl script successsfully.

If I edit the web.xml file to change the cgiPathPrefix to, for example,
myscripts/cgi and then
I enter the url //localhost:8080/mywebapp/myscripts/cgi/myperl it simply
displays the perl script code.
Again if I enter the url //localhost:8080/mywebapp/cgi-bin/myperl it
executes the myperl script successsfully.

TIA

Steve.

©2008 junlu.com - Jax Systems, LLC, U.S.A.