Geoserver发布metro服务

本文介绍了如何将GeoServer前端与Spring MVC框架整合,并详细说明了整合过程中所需的配置步骤及必要的依赖文件。此外,还提供了具体的`web.xml`和`applicationContext.xml`配置示例。
摘要由CSDN通过智能技术生成
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);
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值