tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Boland" <bola...@mediaone.net>
Subject RE: TC4 and cgi
Date Sun, 24 Feb 2002 01:37:38 GMT
Jared,

Ironically, I also was trying to get the CGIServlet to work on Friday
with great difficulty. I believe I got it to work (although I am not a
Perl person). I am using tomcat on Windows 2000 and I just wanted to
invoke an test executable batch file (test.bat) just to see if I could
get the ting to work. I assume you can replace what I did with your perl
scripts and be on your way.

One flaw I noticed in the documentation for the CGIServlet is that the
example does not work in TC 4.0.2 unless you specify a cgiPathPrefix of
"WEB-INF/cgi". The default is actually a null value and so no path is
added to the base of the web application. For example, if the web
application is at path "/foo" and you do not specify a cgiPathPrefix,
then when you enter http://localhost/foo/cgi-bin/test.bat it looks at
the "/foo" directory. At least the source code and testing proved
otherwise. I hope some contributor will read this and verify and correct
this. I'm new to this list so I don't know the ropes too well.

I am using TC as a web server and have not attempted to integrate it
with Apache HTTP Server. Of course, the Apache Server can handle the CGI
requests for you too.

Anyway, here's some snippets from the web.xml file for a web application
in TC 4.0.2. My web application has a path of "/foo" for the web.xml
file is at "/foo/WEB-INF/web.xml" and I create the directory named "cgi"
in the "/foo/WEB-INF" directory. I renamed just the
servlets-cgi.renametojar since I only needed the CGI capability. Now I
just need to hook into the CGI I want to use (Crystal Reports CGI
interface).


  <servlet>
    <servlet-name>cgi</servlet-name>
 
<servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
    <init-param>
      <param-name>cgiPathPrefix</param-name>
      <param-value>WEB-INF/cgi</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>99</param-value>
    </init-param>
  </servlet>

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


Hope this helps,

bill


-----Original Message-----
From: Jared Nedzel [mailto:nedzel@mpi.com] 
Sent: Friday, February 22, 2002 12:17 PM
To: Tomcat Users List
Subject: Re: TC4 and cgi

Paul:

That doesn't appear to me to be the case, given that TC 4
has a bunch of stuff in web.xml concerning CGIs.  For example
there are entries in web.xml like:

<!-- IMPORTANT: To use the CGI servlet, you also need to rename the
<!--            $CATALINA_HOME/server/lib/servlets-ssi.renametojar file
<!--            to $CATALINA_HOME/server/lib/servlets-ssi.jar

and:

<!-- Common Gateway Includes (CGI) processing servlet, which supports
<!-- execution of external applications that conform to the CGI spec
<!-- requirements.  Typically, this servlet is mapped to the URL pattern
<!-- "/cgi-bin/*", which means that any CGI applications that are
<!-- executed must be present within the web application.  This servlet
<!-- supports the following initialization parameters (default values
<!-- are in square brackets):
<!--
<!--   cgiPathPrefix       The CGI search path will start at
<!--                       webAppRootDir + File.separator + this prefix.
<!--                       [WEB-INF/cgi]
<!--
<!--   clientInputTimeout  The time (in milliseconds) to wait for input
<!--                       from the browser before assuming that there
<!--                       is none.  [100]
<!--
<!--   debug               Debugging detail level for messages logged
<!--                       by this servlet.  [0]
<!-- IMPORTANT: To use the CGI servlet, you also need to rename the
<!--            $CATALINA_HOME/server/lib/servlets-cgi.renametojar file
<!--            to $CATALINA_HOME/server/lib/servlets-cgi.jar


But if that is the case, then can someone point me to
doc about how I can integrate TC 4 with Apache?  The
previous versions of TC document this pretty well:

http://jakarta.apache.org/tomcat/tomcat-3.3-doc/tomcat-apache-howto.html

Where's the equivalent for TC 4?  I've seen doc for TC 4
that discusses proxy servers, but I don't know enough to know
whether that's the same thing, or something different.

Someone help out a flailing newbie here...

Jared

Paul D. Bain wrote:
> At Friday 2/22/02 11:58 AM, you wrote:
>         I am not an expert on Tomcat 4, but am 90% sure that it cannot

> begin execution of any executable program/script other than a 
> servlet/JSP. My understanding (which may be flawed) of this issue is 
> that, if you want to run both Perl and servlets, you must put an
Apache 
> web server in front of Tomcat and have it process requests according
to 
> whether they invoke Perl files (e.g., the request is for a file whose 
> suffix is ".pl") or a servlet (which typically has a different suffix,

> to wit, ".jsp" or ".java"). Apache would process requests for the
former 
> via CGI and send requests for the latter to Tomcat.


--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>




--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message