Geoserver发布metro服务

geoserver前端采用spring mvc作为控制层。可以参考spring mvc与metro的整合。

metro官网https://metro.dev.java.net/上有对两者整合的介绍。但上面的example说的很不清楚,上午还能访问的官网,现在已经挂掉了,不知道什么时候能恢复。

现在geoserver最新版本是2.0.2,因为采用了spring 2.5.5,所以只需要导入两个额外的jar包就可以了。

xbean-spring-2.8.jar
http://ftp.cica.es/mirrors/maven2/org/apache/xbean/xbean-spring/2.8/

jaxws-spring-1.8.jar
http://download.java.net/maven/2/org/jvnet/jax-ws-commons/spring/jaxws-spring/1.8/

web.xml

修改几个地方


<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<listener>
<listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener
</listener-class>
</listener>
<servlet>
<servlet-name>MetroLibraryPort</servlet-name>
<servlet-class>com.sun.xml.ws.transport.http.servlet.WSSpringServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>MetroLibraryPort</servlet-name>
<url-pattern>/ws/</url-pattern>
</servlet-mapping>

<listener>
<listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener
</listener-class>
</listener>
<servlet>
<servlet-name>MetroLibraryPort</servlet-name>
<servlet-class>com.sun.xml.ws.transport.http.servlet.WSSpringServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>MetroLibraryPort</servlet-name>
<url-pattern>/ws/</url-pattern>
</servlet-mapping>

applicationContext.xml


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:ws="http://jax-ws.dev.java.net/spring/core"
xmlns:wss="http://jax-ws.dev.java.net/spring/servlet"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://jax-ws.dev.java.net/spring/core http://jax-ws.dev.java.net/spring/core.xsd
http://jax-ws.dev.java.net/spring/servlet http://jax-ws.dev.java.net/spring/servlet.xsd">
<wss:binding url="/ws/">
<wss:service>
<ws:service bean="#webService"/>
</wss:service>
</wss:binding>
<bean id="webService" class="com.wsImpl"/>

</beans>

还要对geoserver的AdvancedDispatchFilter做下处理
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) request;
//begin jacky
if(req.getPathInfo()==null ){
chain.doFilter(request, response);
return;
}
//end
if (request instanceof HttpServletRequest) {
request = new AdvancedDispatchHttpRequest((HttpServletRequest) request);
}
chain.doFilter(request, response);
}
转载自:https://blog.csdn.net/hua2016197/article/details/83681593

You may also like...