Search code examples
ajaxjbossseamseam-conversation

Keeping Session and Conversation alive in Seam


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?


Solution

  • 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.