views:

114

answers:

1

I have a problem with the way sessions and conversations are handled in Seam. We have some rather long forms where most of the time you start filling in the first screen and then some actions are executed in the background and the users leave the computer to do some work, and then later they come back and annotate the work.

Problem is that most of the time the sessions time out or the conversations timed out. While the second one can be easily fixed by splitting the workflow, the first is more important, since the user has to log back in, navigate to the right screen and only then can enter the annotation.

Is there a simple way to have a snippet of Ajax that would trigger a refresh of the session in the background. This would allow us to keep the sessions alive indefinitely.

Also is there an easy way to keep conversations alive?

+1  A: 

Are you using RichFaces? We use something like this to keep the session alive.

<a4j:poll interval="10000" reRender="form1" action="#{logger.userIsAlive}" /> 

The "action" attribute is optional, we use it to keep a record of the connected users. We don't use conversations but I would say that this would also keep the conversation alive.

If you are not using RichFaces, then you could use an AJAX framework like JQuery to ping the server by calling a Servlet for example.

germanescobar
I had some problem with it since I have to also wrap it in <a4j:region/> and <h:form/> (my bad, didn't read the docu good enough). But now it works like a charm.Only problem I didn't think about is when <a4j:poll/> pings the server and the user clicks a link it will throw a concurrent call to conversation error, which is incredibly ugly, any chance of avoiding that without disabling all the links?
cdecker
The easiest way is to add the "eventsQueue" property to the a4j tags. There is also a global queue you can configure, check the RichFaces documentation. http://docs.jboss.org/richfaces/latest_3_3_X/en/devguide/html/ArchitectureOverview.html#QueueandTrafficFloodProtection
germanescobar