<url-pattern>/remoting/*</url-pattern>
</servlet-mapping>
Spring 2提供的remote包学习笔记(3)
时间:2011-09-14
服务器端配置:
<bean id="bookService" class="com.xmatthew.spring.remote.BookService">
</bean>
<bean name="/bookService" class="org.springframework.remoting.caucho.HessianServiceExporter">
<property name="service" ref="bookService"/>
<property name="serviceInterface" value="com.xmatthew.spring.remote.IBookService"/>
</bean>
客户端配置:
<bean class="com.xmatthew.spring.remote.client.BookQueryService">
<property name="bookService" ref="bookService"/>
</bean>
<bean id="bookService" class="org.springframework.remoting.caucho.HessianProxyFactoryBean">
<property name="serviceUrl" value="http://localhost:8080/bookService"/>
<property name="serviceInterface" value="com.xmatthew.spring.remote.IBookService"/>
</bean>
使用Spring2 发布 基于Http的Burlap服务示例
Burlap,它是一个基于XML的Hessian替代方案。它的配置方法和上述Hessian的一样。只要把 Hessian 换成 Burlap 就行了。
服务器端使用:
org.springframework.remoting.caucho.BurlapServiceExporter 发布服务
客户端使用:
org.springframework.remoting.caucho.BurlapProxyFactoryBean
Spring 2提供的remote包学习笔记(4)
时间:2011-09-14
使用Spring2 发布 基于HTTP调用器暴露服务
和使用自身序列化机制的轻量级协议Burlap和Hessian相反,Spring HTTP调用器使用标准Java序列化机制来通过HTTP暴露业务.
但其配置与Burlap和Hessian很相近
服务器端配置:
<bean id="bookService" class="com.xmatthew.spring.remote.BookService">
</bean>
<bean name="/bookService" class="org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter">
<property name="service" ref="bookService"/>
<property name="serviceInterface" value="com.xmatthew.spring.remote.IBookService"/>
</bean>
客户端配置:
<bean class="com.xmatthew.spring.remote.client.BookQueryService">
<property name="bookService" ref="bookService"/>
</bean>
<bean id="bookService" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
<property name="serviceUrl" value="http://localhost:8080/bookService"/>
<property name="serviceInterface" value="com.xmatthew.spring.remote.IBookService"/>
</bean>
|