Tomcat跨域配置
之前有写过关于GeoServer跨域配置——加载地图服务的文章-《Openlayers与GeoServer:跨域配置与WMS服务加载》,而Tomcat的跨域配置,两者在本质上是一样的,都是通过配置filter过滤器组件实现的。
在Tomcat安装目录下找到conf/web.xml配置文件,在/web-app根结点下,添加如下内容即可,
<filter>
<filter-name>CorsFilter</filter-name>
<filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
<init-param>
<param-name>cors.allowed.origins</param-name>
<param-value>*</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CorsFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Tomcat缓存配置
在使用Tomcat部署三维地图服务时,遇到如下的警告信息,
根据警告信息内容,我们通过如下的配置来增加Tomcat的缓存空间大小,
配置方式:在Tomcat安装目录下的conf/context.xml文件的context根节点下,添加如下内容即可,可根据需要自定义cacheMaxSize的取值。
<Resources cachingAllowed="true" cacheMaxSize="1024000" />