<div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial"><P>I know this has been asked before.but....<BR>I mean there is sth different.<BR>Openlayer2.11 Apache-Tomcat7.0(not Apache)</P>
<P>So my question is how to set up the proxy host in Tomcat7.0</P>
<P>I find this by google.but I could find&nbsp; servlets-cgi,and there is no server folder,etc.<BR>It is totally different.</P>
<P>Any suggestion will be welcome.</P>
<P>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: </P>
<P>&nbsp;&nbsp;&nbsp; &lt;servlet&gt;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;servlet-name&gt;cgi&lt;/servlet-name&gt;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;servlet-class&gt;org.apache.catalina.servlets.CGIServlet&lt;/servlet-class&gt;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;init-param&gt;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;param-name&gt;debug&lt;/param-name&gt;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;param-value&gt;0&lt;/param-value&gt;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/init-param&gt;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;init-param&gt;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;param-name&gt;cgiPathPrefix&lt;/param-name&gt;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;param-value&gt;WEB-INF/cgi&lt;/param-value&gt;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/init-param&gt;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;load-on-startup&gt;5&lt;/load-on-startup&gt;&nbsp; <BR>&nbsp;&nbsp;&nbsp; &lt;/servlet&gt;&nbsp; </P>
<P>&nbsp;&nbsp;&nbsp; &lt;servlet-mapping&gt;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;servlet-name&gt;cgi&lt;/servlet-name&gt;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;url-pattern&gt;/cgi-bin/*&lt;/url-pattern&gt;&nbsp; <BR>&nbsp;&nbsp;&nbsp; &lt;/servlet-mapping&gt;&nbsp; </P>
<P>You have also to add this piece of code: </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;param-name&gt;executable&lt;/param-name&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;param-value&gt;c:\python25\python.exe&lt;/param-value&gt;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/init-param&gt;</P>
<P>&lt;init-param&gt;<BR>&lt;param-name&gt;passShellEnvironment&lt;/param-name&gt;<BR>&lt;param-value&gt;true&lt;/param-value&gt;<BR>&lt;/init-param&gt;</P>
<P><BR>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 </P>
<P>3.- I downloaded the "proxy.cgi" file from Openlayers: <A href="http://trac.openlayers.org/browser/trunk/openlayers/examples/proxy.cgi">http://trac.openlayers.org/browser/trunk/openlayers/examples/proxy.cgi</A> 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" </P>
<P>4.- In the proxy.cgi file I included my machine in the allowed hosts: </P>
<P>allowedHosts = ['demo.mapfish.org', 'localhost:5000', 'localhost', '127.0.0.1'] </P>
<P>5.- I included this piece of code in my map: </P>
<P>OpenLayers.ProxyHost = "/client/cgi-bin/proxy.cgi?url="; <BR>6.- I also included in our client folder the context.xml file: </P>
<P>C:\Archivos de programa\Apache Software Foundation\Tomcat 5.5\webapps\client\META-INF\context.xml </P>
<P>Make sure that the privileged is set to: "true": </P>
<P>&lt;Context privileged="true" antiResourceLocking="false" antiJARLocking="false" /&gt;</P>
<P>7.- Restart Tomcat. </P>
<P>&nbsp; <BR></P></div><br><br><span title="neteasefooter"><span id="netease_mail_footer"><hr/>
<a href="http://v.163.com/special/positivepsychology/?from=mailfooter" target="_blank">网易公开课推出哈佛最受欢迎《幸福》课程,帮您修满幸福学分!</a>
</span></span>