Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » SessionSingletonBase reset each time the page is refreshed
SessionSingletonBase reset each time the page is refreshed [message #644355] Fri, 10 December 2010 16:41 Go to next message
Jean Bovet is currently offline Jean BovetFriend
Messages: 34
Registered: September 2009
Member
Hi,

I am facing a problem with SessionSingletonBase and I would like to
make sure I understand how this class works. My understanding is that
this class will provide singleton instance scoped per session. However,
when I use it in my application, each time I refresh the web page, a
new instance is created while the session id is still the same (I
checked with the debugger on the RWT.getSessionStore()). Is that the
intended behavior? If so, how can I make sure my singleton are
persisted when the web page is refreshed?

I suppose the reason is that the session store is still cleared after a
refresh (https://bugs.eclipse.org/bugs/show_bug.cgi?id=306599)?

Thanks,

Jean
Re: SessionSingletonBase reset each time the page is refreshed [message #644463 is a reply to message #644355] Sat, 11 December 2010 17:09 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

Hi Jean,

even though the HTTP session is still the same after a reload, RAP
considers a new application start as a new session, i.e. the SessionStore
is cleaned up and a SessionSingletons will create a new instance. If you
need to persist data over a browser reload, you could store it in the
HTTP session.

Regards, Ralf

--
Ralf Sternberg

Twitter: http://twitter.com/ralfstx
Blog: http://www.eclipsesource.com/blogs/

Professional support for RAP and RCP?
http://www.eclipsesource.com/support/
Re: SessionSingletonBase reset each time the page is refreshed [message #644481 is a reply to message #644463] Sun, 12 December 2010 00:19 Go to previous messageGo to next message
Jean Bovet is currently offline Jean BovetFriend
Messages: 34
Registered: September 2009
Member
Hi Ralf,

Ok, got it! Thanks for your explanation.

Regards,

Jean

On 2010-12-11 09:09:06 -0800, Ralf Sternberg said:

> Hi Jean,
>
> even though the HTTP session is still the same after a reload, RAP
> considers a new application start as a new session, i.e. the SessionStore
> is cleaned up and a SessionSingletons will create a new instance. If you
> need to persist data over a browser reload, you could store it in the
> HTTP session.
>
> Regards, Ralf
Re: SessionSingletonBase reset each time the page is refreshed [message #780626 is a reply to message #644463] Wed, 18 January 2012 20:02 Go to previous messageGo to next message
Ronald So is currently offline Ronald SoFriend
Messages: 198
Registered: April 2011
Senior Member
Ralf,

Can you provide a little more information on this topic? Do you have an example somewhere that demonstrates how to get around browser reload?

Thanks,
Ronald
Re: SessionSingletonBase reset each time the page is refreshed [message #780753 is a reply to message #780626] Thu, 19 January 2012 10:01 Go to previous messageGo to next message
Avrajit Chatterjee is currently offline Avrajit ChatterjeeFriend
Messages: 68
Registered: September 2011
Member
Hi Ronald,

When you create an object using SessionSingletonBase class it is created and stored in local SessionStrore (not in an httpSession object as it used to happen in some earlier release of RAP). When you refresh/reload the application the previous SessionStore object is destryored (along with the old UIThread ) and a new SessionStore object (along with a new UIThread) is created , hence you loose all your Session singleton objects. To preserve the objects you can create those objects yourself (without using SessionSingletonBase class) and store them in HttpSession (you can find the code snippet very easily over the net as its a general mechanism followed in the J2EE world).

Ralf,

Correct me if I am wrong.

Regards
Avrajit
Re: SessionSingletonBase reset each time the page is refreshed [message #780901 is a reply to message #780753] Thu, 19 January 2012 21:06 Go to previous message
Ronald So is currently offline Ronald SoFriend
Messages: 198
Registered: April 2011
Senior Member
Thanks Avrajit. I understand what you mean by leveraging HttpSession directly instead of SessionSingletonBase, but it is still not clear to me on the general scheme to handle the situation when user presses F5. For example, I can now successfully retain user's login information in HttpSession (and retrieve it later in other views). But now when I press F5, I only see a blank page with no error messages or any stack trace. Perhaps it will be great if you can point me to some code snippets that you mentioned about?

Thanks a lot again.
Previous Topic:strategy for passing in User auth session from main webApp to rap web app
Next Topic:Server session timed out for two RAP instance in same browser
Goto Forum:
  


Current Time: Thu Oct 28 09:18:14 GMT 2021

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

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

Back to the top