http://s3.amazonaws.com/dist.springframework.org/release/SPR/spring-framework-2.5.6.SEC01-with-dependencies.zip
<beans>
<bean id="defaultHandlerMapping" class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"/>
<bean id="helloService" class="lavasoft.suths.service.HelloService"/>
<bean name="/hello" class="org.springframework.remoting.caucho.HessianServiceExporter">
<property name="service" ref="helloService"/>
<property name="serviceInterface" value="lavasoft.suths.service.Hello"/>
</bean>
</beans>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/hessian-servlet.xml
</param-value>
</context-param>
<servlet>
<servlet-name>hessian</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>4</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>hessian</servlet-name>
<url-pattern>/hessian/*</url-pattern>
</servlet-mapping>
</web-app>
import com.caucho.hessian.client.HessianProxyFactory;
import lavasoft.suths.service.Hello;
import java.net.MalformedURLException;
/**
* 客户端调用(会依赖服务接口)
*
* @author leizhimin 2009-8-14 12:29:33
*/
public class Client {
public static void main(String[] args) throws MalformedURLException {
String url = "http://localhost:8080/hessianapp/hessian/hello";
HessianProxyFactory factory = new HessianProxyFactory();
Hello hello = (Hello) factory.create(Hello.class, url);
System.out.println(hello.sayHello("Hessian"));
}
}
Process finished with exit code 0
<beans>
<bean id="helloServiceClient" class="org.springframework.remoting.caucho.HessianProxyFactoryBean">
<property name="serviceUrl" value="http://localhost:8080/hessianapp/hessian/hello"/>
<property name="serviceInterface" value="lavasoft.suths.service.Hello"/>
</bean>
</beans>
import lavasoft.suths.service.Hello;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* Spring整合Hessian,客户端测试
*
* @author leizhimin 2009-8-14 15:32:46
*/
public class TestClient {
public static void main(String[] args) {
try {
ApplicationContext context = new ClassPathXmlApplicationContext("/remoting-client.xml");
Hello hello = (Hello) context.getBean("helloServiceClient");
System.out.println(hello.sayHello("Spring Hession"));
}
catch (Exception e) {
e.printStackTrace();
}
}
}
Process finished with exit code 0
spring-aop.jar
spring-beans.jar
spring-context.jar
spring-context-support.jar
spring-core.jar
spring-jdbc.jar
spring-jms.jar
spring-orm.jar
spring-test.jar
spring-tx.jar
spring-web.jar
spring-webmvc.jar
spring-webmvc-portlet.jar
spring-webmvc-struts.jar
hessian-3.1.3.jar
aopalliance.jar
commons-logging.jar