源码地址
git@github.com:chenyaoBOY/hessian.git
https://github.com/chenyaoBOY/hessian.git
1.Hessian使用的介绍
Hessian是一个轻量级的RPC框架,基于HTTP协议
1.1 服务端配置
三部曲
- 通过springMVC的DispatherServlet控制Hessian服务接口的URL访问路径 即web.xml配置
- 新建Hessian服务 例如:DemoService 和实现类 DemoServiceImpl
- 配置Hessian服务的暴露 通过HessianServiceExporter
代码示例
1.1.1pom文件 : spring pom文件 + Hessian pom文件
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<spring.version>4.1.7.RELEASE</spring.version>
</properties>
<dependencies>
<!-- Junit单元测试 -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<!-- Hessian的包 -->
<dependency>
<groupId>org.study</groupId>
<artifactId>hessian-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.caucho</groupId>
<artifactId>hessian</artifactId>
<version>4.0.38.1</version>
</dependency>
<!-- 添加Spring支

本文是一篇关于Spring整合Hessian的详细教程,包括Hessian服务端配置的三步操作和客户端调用的两种方式。通过web.xml、applicationContext.xml配置,演示了Hessian服务的暴露和客户端接口调用。提醒注意URL路径中可能包含的项目名称。源码可在GitHub找到。
最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



