geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevan Miller <kevan.mil...@gmail.com>
Subject Re: CGI and Geronimo/Tomcat
Date Sat, 12 Jul 2008 15:59:47 GMT

On Jul 11, 2008, at 5:14 PM, Peter L. Berghold wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hey folks,
>
> I've been doing web searches looking for the answer to this and I  
> can't
> find my Geronimo book wherever I put it last.  I am trying enable the
> processing of CGI scripts on Geronimo.
>
> Can someone point me in the right direction?

Should be doable. I don't recall hearing about anyone who's set this  
up on Geronimo, however. If you're willing to run some experiments, I  
expect that we can help get it running...

Are you using Tomcat or Jetty as your web container?

Here's general info for Tomcat -- http://tomcat.apache.org/tomcat-6.0-doc/cgi-howto.html
Here's general info for Jetty -- http://jetty.mortbay.org/jetty5/faq/faq_s_900-Content_t_CGI.html

Now a matter of getting this running in Geronimo. Assuming you're  
using Tomcat as a web container, I'd deploy this as a web-app:

Place your scripts in WEB-INF/cgi/

Borrowing from the tomcat instructions use this as your WEB-INF/web.xml:

<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd

"
    version="2.5" >

   <!-- 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]                                 -->
    
< 
!--                                                                      -->
   <!--   debug                Debugging detail level for messages  
logged    -->
   <!--                        by this servlet.   
[0]                         -->
    
< 
!--                                                                      -->
   <!--   executable           Name of the exectuable used to run  
the        -->
   <!--                        script.  
[perl]                                -->
    
< 
!--                                                                      -->
   <!--   parameterEncoding    Name of parameter encoding to be used  
with    -->
   <!--                        CGI  
servlet.                                  -->
   <!--                         
[System.getProperty("file.encoding","UTF-8")] -->
    
< 
!--                                                                      -->
   <!--   passShellEnvironment Should the shell environment variables  
(if    -->
   <!--                        any) be passed to the CGI script?  
[false]     -->
    
< 
!--                                                                      -->
   <!-- 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             -->

     <servlet>
         <servlet-name>cgi</servlet-name>
         <servlet-class>org.apache.catalina.servlets.CGIServlet</ 
servlet-class>
         <init-param>
           <param-name>debug</param-name>
           <param-value>0</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>

     <!-- The mapping for the CGI Gateway servlet -->

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

</web-app>

Deploy the app and test... Let us know your results.

--kevan

Mime
View raw message