1.Geoserver的安装
Geoserver安装包下载地址:http://geoserver.org/release/maintain/。下载的是windows安装版。
安装完成后,启动geoserver。在浏览器打开 http://localhost:8080/geoserver/web/,默认账号:admin 默认密码:geoserver
2.jar包拷贝
去geoserve的lib目录下 geoserver\lib找jetty-servlets-XX.jar , jetty-util-xx.jar,jetty-http-XX.jar(xx表示不同的版本)3个jar包;
把3个jar包拷贝到geoserver\webapps\geoserver\WEB-INF\lib\目录下;
3.修改web.xml文件
去geoserver\webapps\geoserver\WEB-INF目录下找web.xml,进行如下修改:
- 添加如下内容,若是有,可以直接取消注释
<!-- Uncomment following filter to enable CORS -->
<filter>
<filter-name>cross-origin</filter-name>
<filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>
<init-param>
<param-name>chainPreflight</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>allowedOrigins</param-name>
<param-value>*</param-value>
</init-param>
<init-param>
<param-name>allowedMethods</param-name>
<param-value>GET,POST,PUT,DELETE,HEAD,OPTIONS</param-value>
</init-param>
<init-param>
<param-name>allowedHeaders</param-name>
<param-value>*</param-value>
</init-param>
</filter>
<!-- Uncomment following filter to enable CORS -->
<filter-mapping>
<filter-name>cross-origin</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>