Java Hessian,添加标题
我正在使用Hessian调用一个Java方法,是否可以在发送消息之前添加HTTP头,这样我就可以在消息头中添加“授权” 我使用的是Spring,因此我目前获得了一个代理bean并在代理上进行调用:Java Hessian,添加标题,java,header,hessian,Java,Header,Hessian,我正在使用Hessian调用一个Java方法,是否可以在发送消息之前添加HTTP头,这样我就可以在消息头中添加“授权” 我使用的是Spring,因此我目前获得了一个代理bean并在代理上进行调用: <bean id="beanRetrievalService" class="org.springframework.remoting.caucho.HessianProxyFactoryBean"> <property name="serviceUrl" value
<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>
您不能添加随机头,但使用Hessian可以进行HTTP身份验证。以下是如何以编程方式执行此操作:
HessianProxyFactory factory = new HessianProxyFactory();
factory.setUser("neo");
factory.setPassword("thereisnospoon");
MyInterface service = (MyInterface) factory.create(MyInterface.class, "http://example.com/hessian/MyService");
我假设Springbean具有类似的用户名和密码设置器。您不能添加随机头,但使用Hessian可以进行HTTP身份验证。以下是如何以编程方式执行此操作:
HessianProxyFactory factory = new HessianProxyFactory();
factory.setUser("neo");
factory.setPassword("thereisnospoon");
MyInterface service = (MyInterface) factory.create(MyInterface.class, "http://example.com/hessian/MyService");
我假设Springbean具有类似的用户名和密码设置器。它也可能传播其他隐式上下文信息。然而,为此,必须对Hessian类进行一些扩展,如此处所述:也可以传播其他隐式上下文信息。然而,为此目的,必须对Hessian类进行一些扩展,如以下所述: