Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » How to catch expire session?
How to catch expire session? [message #1833135] Sat, 03 October 2020 08:17 Go to next message
Dmitry Dukhov is currently offline Dmitry DukhovFriend
Messages: 195
Registered: February 2013
Senior Member
Hello

I set timeout for RWT session
RWT.getUISession().getHttpSession().setMaxInactiveInterval(timeout * 60 * 60);

How to catch expire timeout and put warning message to user?
Dmitry
Re: How to catch expire session? [message #1833238 is a reply to message #1833135] Wed, 07 October 2020 12:24 Go to previous messageGo to next message
Linuxhippy Mising name is currently offline Linuxhippy Mising nameFriend
Messages: 72
Registered: July 2009
Member
Hi,

There is no way to notify the user - no connection is active (and non has been for your timeout period), that is the reason the session expired in the first place.

What I did for a high-user-page was to let the clients poll every few minutes (~3minutes), and set a short timeout(6 minutes):

		int pollingTimeoutMS = 6*3600*1000; //stop keeping the session alive after 6hours
			RWT.getUISession().getHttpSession().setMaxInactiveInterval(180);
			String code =   ""
					+ "var pollStart = Date.now();"
					+ "window.setInterval( function() {\n"
					+ "     if((pollStart + " + pollingTimeoutMS + ") > Date.now()) {" 
		               + "     rwt.remote.Connection.getInstance().send();\n"
		               + "  }"
		               + "}, 150000 );";		
			 JavaScriptExecutor executor = RWT.getClient().getService( JavaScriptExecutor.class );
			 if( executor != null ) {
			     executor.execute( code );
			 }	


This will cost a tiny little bit of CPU and bandwidth, however with the benefit of freeing sessions rather aggressivly without impacting the user experience.

[Updated on: Wed, 07 October 2020 12:24]

Report message to a moderator

Re: How to catch expire session? [message #1833256 is a reply to message #1833238] Wed, 07 October 2020 21:25 Go to previous message
Dmitry Dukhov is currently offline Dmitry DukhovFriend
Messages: 195
Registered: February 2013
Senior Member
Think I was wrong.
Command "MaxInactiveInterva"lsets timeout for inactive session but my application has thread for auto-update widgets and setMaxInactiveInterval does not help me check users' activity. It's permanent session!. Isn't it?

p.s. I can catch event SWT.Selection for buttons, list and etc and update last time real user' actiivty
Previous Topic:RAP img token with markup and varying size
Next Topic:How to chnage the width of a ScrolledComposite
Goto Forum:
  


Current Time: Tue Dec 03 03:29:28 GMT 2024

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

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

Back to the top