spring-remoting中的httpInvoker实现并安全验证

本文介绍了Spring的HTTPInvoker远程调用实现,包括客户端和服务器端的工作流程,详细阐述了配置过程和调用测试。接着,讨论了如何在HTTPInvoker中添加安全验证,特别是客户端和服务器端的配置,以及服务端使用filter进行验证的方法。文章最后提到了关于spring-remoting调用的更多资源链接。
摘要由CSDN通过智能技术生成


  1. 简单介绍httpInvoker的实现

           Spring中,HTTPInvoker(HTTP调用器)是通过基于HTTP协议的分布式远程调用解决方案.

           1.1客户端

                    a.向服务器发送远程调用请求:远程调用信息——>封装为远程调用对象——>序列化写入到远程调用HTTP请求中——>向服务器端发送。
                    b.接收服务器端返回的远程调用结果:服务器端返回的远程调用结果HTTP响应——>反序列化为远程调用结果对象。

          1.2服务端

                    a. 接收客户端发送的远程调用请求:客户端发送的远程调用HTTP请求——>反序列化为远程调用对象——>调用服务器端目标对象的目标方法处理。

                    b.向客户端返回远程调用结果: 服务器端目标对象方法的处理结果——>序列化写入远程调用结果HTTP响应中——>返回给客户端。


  2. 具体如何配置

    

      2.1 客户端配置

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE beans PUBLIC
    "-//SPRING//DTD BEAN//EN"
     "http://www.springframework.org/dtd/spring-beans.dtd">
<beans default-autowire="byName">

       ......

     <bean id="testService" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
        <property name="serviceUrl" value="http://127.0.0.1:8300/testService.service"/>
        <property name="serviceInterface" value="com.xxx.biz.service.TestService"/>
    </bean>

</beans>

       2.2 服务端配置

<pre name="code" class="html"><?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE beans PUBLIC
    "-//SPRING//DTD BEAN//EN"
     "http://www.springframework.org/dtd/spring-beans.dtd">
<beans default-autowire="byName">


.... 

<bean id="testService" class="com.xxxx.biz.service.impl.TestServiceImpl"></bean>
<bean name="/testService.service" class="org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter"> 
     <property name="service" ref="testService" />
     <property name="serviceInterface" value="com.xxx.biz.service.TestService" />
</bean>


</beans>


     web.xml配置:

	<servlet>
        <servlet-name>remoting</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-o
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值