2011-11-07 48 views
0

我正在调用使用Hessian的Java方法,是否可以在发送消息之前添加HTTP标头 - 因此我可以将“授权”添加到消息标头中?Hessian,添加标题

我使用Spring,所以我目前得到一个代理bean,并在代理呼叫:

<bean id="beanRetrievalService" class="org.springframework.remoting.caucho.HessianProxyFactoryBean"> 
    <property name="serviceUrl"  value="http://z.y.z/myService" /> 
    <property name="serviceInterface" value="x.y.z.MyInterface" /> 
</bean> 

回答

0

您不能添加一个随机的头,但HTTP认证是可能与黑森州。这里是你如何以编程方式:

HessianProxyFactory factory = new HessianProxyFactory(); 
    factory.setUser("neo"); 
    factory.setPassword("thereisnospoon"); 

    MyInterface service = (MyInterface) factory.create(MyInterface.class, "http://example.com/hessian/MyService"); 

我假设Spring bean有类似的设置用户名和密码。