How to restore UISession? [message #1039933] |
Fri, 12 April 2013 16:36  |
Eclipse User |
|
|
|
Use case: user works with a RAP application (e.g. by filling out dialog values, going through wizards, etc) and then browser suddenly crashes or the user accidentally closes web browser itself.
Is it possible to restore user's session in the same state as it was before browser closure (i.e. with dialog up and values filled in it)?
In technical terms, I'm suspecting this has to do with UISession object lifecycle which under normal conditions is disposed when browser is closed. Is there a way to prevent UISession from "dying"/disposal?
Thank you.
|
|
|
Re: How to restore UISession? [message #1039965 is a reply to message #1039933] |
Fri, 12 April 2013 17:47   |
Eclipse User |
|
|
|
Unfortunately this is not possible. It's more complicated than just reconnecting to the UISession on the server. The UISession is tied to the HttpSession, so it will indeed stay around until the session times out (or the user reconnects when it will be cleaned up and a new one created). The problem is that there isn't currently a way to reconstruct the client browser state from the server representation. It should technically be possible, but I think it will require a significant effort.
The best solution is to implement this functionality at the application level. There is some existing functionality for BrowserHistory and BrowserNavigation (see the Deep Links section)[1] which could be leveraged in your application. For instance, you could use the BrowserHistory to push information about the open dialog which your application could then query on startup to restore the state. Also, see the Exit Confirmation support on that same page which allows you to prompt users when before they exit the application and accidentally lose information.
If you want to go one step further and save the information entered in the dialog/wizard, you can store that information on the server (by registering Modify/Focus listeners on the widgets). You could store that in the HttpSession (see User-specific data)[2], but it may be lost if the browser crashes and doesn't reconnect to the same HttpSession. You could also use the ApplicationContext[also 2], a global singleton, an OSGi service, or similar mechanism to store the partially-entered data (you would need a userId or similar key, of course). This would naturally be quite a bit of work, so consider if your users really expect such behavior.
[1] http://eclipse.org/rap/developers-guide/devguide.php?topic=navigation.html&version=2.0
[2]http://eclipse.org/rap/developers-guide/devguide.php?topic=data-stores.html&version=2.0
Hope that helps,
Cole Markham
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05813 seconds