Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » How to restore UISession?
How to restore UISession? [message #1039933] Fri, 12 April 2013 20:36 Go to next message
Barys Dubauski is currently offline Barys DubauskiFriend
Messages: 38
Registered: July 2009
Member
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 21:47 Go to previous messageGo to next message
Cole Markham is currently offline Cole MarkhamFriend
Messages: 150
Registered: July 2009
Location: College Station, TX
Senior Member

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
Re: How to restore UISession? [message #1042148 is a reply to message #1039965] Tue, 16 April 2013 03:32 Go to previous messageGo to next message
Barys Dubauski is currently offline Barys DubauskiFriend
Messages: 38
Registered: July 2009
Member
Thank you, Cole, for the prompt and elaborate reply.

When you said that "there isn't currently a way to reconstruct the client browser state from the server representation" did you imply that there will be future support in RAP for this use case?

[Updated on: Tue, 16 April 2013 03:33]

Report message to a moderator

Re: How to restore UISession? [message #1042708 is a reply to message #1042148] Tue, 16 April 2013 19:33 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

Hi Barys,

Actually this feature is something we consider for one of the next
versions after 2.1. We call it "UISession reconnect". However, there are
still a couple of open questions such as: How would the client know and
specify the UISession id to connect to? How would the server know which
UISessions to serialize and store? If you have ideas about these,
related to your specific use case, that would be interesting.

Regards, Ralf

--
Ralf Sternberg

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: How to restore UISession? [message #1044318 is a reply to message #1042708] Thu, 18 April 2013 19:10 Go to previous messageGo to next message
Barys Dubauski is currently offline Barys DubauskiFriend
Messages: 38
Registered: July 2009
Member
One of the ideas I had (maybe it isn't going to work but I'll throw it out there anyway) is to have automatic url redirect upon initial client connection (when UISession is created for the first time).

For example, when user connects to the web server <siteURL>/mypath for the first time he/she would automatically be redirected to <siteURL>/mypath?session=xUOSHD10334 and that is the address the user would see in the address bar of the browser. Here xUOSHD10334 is the id of the UISession.

If browser got closed (accidentally or on purpose) and user enters <siteURL>/mypath?session=xUOSHD10334 then RAP would try to restore the UISession with id xUOSHD10334.

If user connects to <siteURL>/mypath then a new UISession would be created.

When UISessions would be recycled? Same timeout based approach could be used here too. The timeout value would be configured on the server end. After UISession has been recycled they would see a message: "Your session has expired. A new session will be established..." and they would be redirected to a new session with a new ID.

[Updated on: Thu, 18 April 2013 19:11]

Report message to a moderator

Re: How to restore UISession? [message #1046702 is a reply to message #1044318] Mon, 22 April 2013 08:47 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

Thanks for your ideas. There may be security concerns about adding the
session id to the URL, however this seems to be the only way to keep the
session id over browser reloads / restarts.

Regards, Ralf

--
Ralf Sternberg

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: How to restore UISession? [message #1698912 is a reply to message #1046702] Thu, 18 June 2015 17:30 Go to previous messageGo to next message
Barys Dubauski is currently offline Barys DubauskiFriend
Messages: 38
Registered: July 2009
Member
No Message Body
Re: How to restore UISession? [message #1698913 is a reply to message #1698912] Thu, 18 June 2015 17:31 Go to previous messageGo to next message
Barys Dubauski is currently offline Barys DubauskiFriend
Messages: 38
Registered: July 2009
Member
Hi, has there been any improvement in RAP related to this issue? Would you like me to open a bugzilla to track this enhancement?
Re: How to restore UISession? [message #1698953 is a reply to message #1698913] Fri, 19 June 2015 07:22 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi,
we already have a bugzilla about it:
389949: Allow session recovery
https://bugs.eclipse.org/bugs/show_bug.cgi?id=389949
Regards,
Ivan

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: How to restore UISession? [message #1699039 is a reply to message #1698953] Fri, 19 June 2015 17:20 Go to previous message
Barys Dubauski is currently offline Barys DubauskiFriend
Messages: 38
Registered: July 2009
Member
Thank you Ivan! I'll subscribe to the bugzilla entry.
Previous Topic:Missing Constraint: Import-Package: javax.servlet; version="2.6.0
Next Topic:SelectionProviders in RAP have strange behavior
Goto Forum:
  


Current Time: Tue Mar 19 05:02:06 GMT 2024

Powered by FUDForum. Page generated in 0.04982 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top