How to add Cross Origin Filter for Jetty in GeoServer on Mac

المشرف العام

Administrator
طاقم الإدارة
I want to add an Access-Control-Allow-Origin:* to the response from GeoServer because I need to download images from another domain. Instand of build a proxy, I prefer to use Cross Origin Filter of Jetty(GeoServer's Web Server) to achieve this. However, I don't know how to set it up in GeoServer.

  1. My GeoServer's version is 2.1.3 so the Jetty's version is 6, which does not include the jetty-servlets.jar.
  2. I downloaded the jetty-servlets-8.1.5.v20120716.jar from here and renamed it to jetty-servlets.jar, then put it into /Applications/GeoServer.app/Contents/Resources/Java/webapps/geoserver/WEB-INF/lib/
  3. Then I add the following codes to the web.xml file at /Applications/GeoServer.app/Contents/Resources/Java/webapps/geoserver/WEB-INF/web.xml
cross-origin
org.eclipse.jetty.servlets.CrossOriginFilter


cross-origin
/*


At last, I restarted GeoServer but the page at http://localhost:8080/geoserver/web showed me an error 404:

HTTP ERROR: 404
NOT_FOUND
RequestURI=/geoserver/web
Powered by jetty://

Is there anyone who can help me? Thank you!



أكثر...
 
أعلى