Persistent connections

I'm writing a web GUI for a commercial product that only allows me to communicate through a Java API which seems to work just great under JRuby.

When the user logs on to the web page the authentication is done like this: sdssession = com.hp.ov.webapi.Session.openSession("", login, pass) and after that I can do things like sdsession.getCurrentAccount() etc to get data from the service.

It works great. The problem is that I have no idea how to keep that session object alive while the user is logged on the web page, it doesn't seem like a good idea if the system has to authenticate again on every page load.

The second option I came up with was to use BackgroundRB ( ) but it doesn't work in JRuby because some of the stuff it does with processes (fork, pipe etc) are not yet implemented.

Any ideas?