[OpenLayers-Users] CGI and Tomcat

Juan Arévalo arevaco90 at yahoo.es
Sun Aug 16 17:13:06 EDT 2009


Hi!

I have finally managed to display my WFS example in the map! It is not so
obvious to set up the proxy host in Tomcat! I would like to share with you
all the steps  I followed, in case that someone need it:

1.- I modified the file: "web.xml" C:\Archivos de programa\Apache Software
Foundation\Tomcat 5.5\conf\web.xml. I uncomented the following lines of
code: 

    <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> 

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

You have also to add this piece of code:

      <param-name>executable</param-name>
        <param-value>c:\python25\python.exe</param-value> 
       </init-param>

<init-param>
<param-name>passShellEnvironment</param-name>
<param-value>true</param-value>
</init-param>


2.- I renamed the file servlets-cgi.renametojar to servlets-cgi.jar under
the folder: C:\Archivos de programa\Apache Software Foundation\Tomcat
5.5\server\lib 

3.- I downloaded the "proxy.cgi" file from Openlayers:
http://trac.openlayers.org/browser/trunk/openlayers/examples/proxy.cgi and
copy the file in a folder called "cgi-bin" that I created under my
directory: "C:\Archivos de programa\Apache Software Foundation\Tomcat
5.5\webapps\client\WEB-INF\cgi\proxy.cgi" 

4.- In the proxy.cgi file I included my machine in the allowed hosts: 

allowedHosts = ['demo.mapfish.org', 'localhost:5000', 'localhost',
'127.0.0.1'] 

5.- I included this piece of code in my map: 

OpenLayers.ProxyHost = "/client/cgi-bin/proxy.cgi?url=";
6.- I also included in our client folder the context.xml file:

C:\Archivos de programa\Apache Software Foundation\Tomcat
5.5\webapps\client\META-INF\context.xml

Make sure that the privileged is set to: "true":

<Context privileged="true" antiResourceLocking="false"
antiJARLocking="false" />

7.- Restart Tomcat. 

Juan 




Juan Arévalo wrote:
> 
> Hi list,
> 
> I am still having some difficulties to set up the proxy host in Tomcat.
> Here are the steps I followed:
> 
> 1.- I modified the file: "web.xml" C:\Archivos de programa\Apache Software
> Foundation\Tomcat 5.5\conf\web.xml. I uncomented the following lines of
> code:
> 
>     <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>
> 
>     <servlet-mapping>
>           <servlet-name>cgi</servlet-name>
>           <url-pattern>/cgi-bin/*</url-pattern>
>     </servlet-mapping> 
> 
> 2.- I renamed the file servlets-cgi.renametojar to servlets-cgi.jar under
> the folder: C:\Archivos de programa\Apache Software Foundation\Tomcat
> 5.5\server\lib
> 
> 3.- I downloaded the "proxy.cgi" file from Openlayers:
> http://trac.openlayers.org/browser/trunk/openlayers/examples/proxy.cgi and
> copy the file in a folder called "cgi-bin" that I created under my
> directory: "Tomcat 5.5\webapps\MapFish-1.1\client\cgi-bin\proxy.cgi"
> 
> 4.- In the proxy.cgi file I included my machine in the allowed hosts:
> 
> allowedHosts = ['demo.mapfish.org', 'localhost:5000', 'localhost',
> '127.0.0.1'] and I also added this line:
> 
> #!c:/python25/python.exe -u (I already had installed python in my PC)
> 
> 5.- I included this piece of code in my map: 
> 
> OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=";
> 
> 
> 6.- I restarted my Tomcat.
> 
> I do not see the openlayers.org website when I typed:
> http://127.0.0.1:8080/MapFish-1.1/client/cgi-bin/proxy.cgi, I got the 404
> error.
> 
> Does anyone knows what I missing?
> 
> 
> Thanks again Eric and Michogar!
> 
> Juan 
> 
> 
> 
> Eric Lemoine-2-2 wrote:
>> 
>> On Thursday, August 6, 2009, Juan Arévalo <arevaco90 at yahoo.es> wrote:
>>>
>>> Hi all,
>>>
>>> I am making some progress setting up a WFS-T, it seems that my code
>>> works
>>> since I don´t get any error, but the layer doesn't display in the map.
>>> I
>>> have read that this problem can be solved by setting the Proxy Host,
>>> however
>>> I was not able to set it up. I am using: Tomcat 5.5, Geoserver 1.5.3 and
>>> OpenLayers 2.8 and MapFish 1.1.(I couldn´t only find the steps for
>>> Apache
>>> but not for Tomcat)
>>>
>>> Does anyone have any ideas on how to solve it?
>> 
>> Hi. If your Tomcat instance serves both the HTML page and the WFS then
>> you don't need a proxy.
>> 
>> 
>> -- 
>> Eric Lemoine
>> 
>> Camptocamp France SAS
>> Savoie Technolac, BP 352
>> 73377 Le Bourget du Lac, Cedex
>> 
>> Tel : 00 33 4 79 44 44 96
>> Mail : eric.lemoine at camptocamp.com
>> http://www.camptocamp.com
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>> 
>> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/CGI-and-Tomcat-tp3400100p3454948.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list