0

I've set up my services as per Spring remoting documentation, but in the client applications I'd like to invoke service methods while reusing the same HTTP session as I'd like to store session related data on the server (instead of querying for that data on every call).

Is this possible?

Client side spring service configuration:

<bean id="partnersServiceImpl" class="org.springframework.remoting.caucho.HessianProxyFactoryBean">
    <property name="serviceUrl" value="http://localhost:8080/partners" />
    <property name="serviceInterface" value="somePackage.PartnersService" />
</bean>

Currently every method called generates a new sessionID:

PartnersService partners = (PartnersService) context.getBean("partnersServiceImpl");

List<?> partnersList = partners.getSomeData(2011); // Will have one SessionID
partnersList = partners.getSomeData(2012); // Will have a new SessionID
Vedran
  • 10,369
  • 5
  • 50
  • 57

2 Answers2

1

Check out the source code of HessianProxy.sendRequest() - it uses standard URLConnection to connect to server and does not handle any cookies. Thus I believe Hessian has no support for cookies at all. After all HTTP is just a transport protocol, while cookies are strictly browser-related technology.

Tomasz Nurkiewicz
  • 334,321
  • 69
  • 703
  • 674
0

Try to put this code at the very start of you application:

CookieHandler.setDefault( new CookieManager( null, CookiePolicy.ACCEPT_ALL ) );

It is a simple setup for cookies support activation. See the javadocs for more information. I have a Hessian remoting too and this is what did the trick.

gargii
  • 1,010
  • 8
  • 16