SpringMVC整合hessian

在能运行的spingmvc下进行配置

1、web.xml

<servlet-mapping>
		<servlet-name>springmvc</servlet-name>
		<url-pattern>*.*</url-pattern>
	</servlet-mapping>

2、spring-servlet.xml

<!-- hessian -->
	<bean id="httpRequestHandlerAdapter" class="org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter"/>
	<bean class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"/>
	<bean id="ccWService" class="com.cloudcc.ccwebsvc.CCWServiceImpl"/>
	<bean name="/ccwservice" class="org.springframework.remoting.caucho.HessianServiceExporter">
    	<property name="service" ref="ccWService"/>
    	<property name="serviceInterface" value="com.cloudcc.ccwebsvc.CCWService"/>
	</bean>
3、pom.xml;

<dependency>
			<groupId>com.caucho</groupId>
			<artifactId>hessian</artifactId>
			<version>4.0.7</version>
		</dependency>


4、访问:http://localhost:8080/cloudcc_global_service/ccwservice

提示:

HTTP Status 405 - HessianServiceExporter only supports POST requests

则表示配置成功。

5、调用:


try{
			String url =  "http://localhost:8080/cloudcc_global_service/ccwservice";
			HessianProxyFactory factory = new HessianProxyFactory();
			CCWService cCWService = (CCWService) factory.create(CCWService.class,url);
			cCWService.checkOrgEnterLogs();
		}catch (Exception e) {
			log.error("执行今日登录校准检查出现异常:"+e.getMessage());
			e.printStackTrace();
		}



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值