我正在使用Hessian调用一个Java方法,是否可以在发送消息之前添加HTTP标头-这样我就可以在消息的标头中添加"Authorization“?
我使用的是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>发布于 2012-02-04 00:35:33
也可以传播其他隐含的上下文信息。然而,出于这个目的,必须对Hesssian类进行一些扩展,例如,在这里描述:http://insidecoffe.blogspot.com/2012/02/hessian-wrapper-to-enable-context.html
发布于 2011-11-07 19:16:31
您不能添加随机标头,但可以使用Hessian进行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具有类似的用户名和密码设置器。
https://stackoverflow.com/questions/8035402
复制相似问题