Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » User (in)activity detection and auto-logout
User (in)activity detection and auto-logout [message #1060215] Thu, 23 May 2013 14:40 Go to next message
Boy D'Poy is currently offline Boy D'Poy
Messages: 56
Registered: October 2011
Member
Hi everyone!

I'd like to know how is it possible from a detected user (in)activity automatically trigger a IClientSession#stopSession for example?

I currently experience great difficulties to combine:

UserActivityManager, UserActivityListener, UserActivityEvent, from the client-side

then

IUserActivityProvider, IUserActivityStateService, UserActivityClientNotification, UserStatusMap, from the server-side.

Thanks!


Once You Go Scout, You Never Come Out!
Re: User (in)activity detection and auto-logout [message #1060461 is a reply to message #1060215] Fri, 24 May 2013 19:53 Go to previous messageGo to next message
Boy D'Poy is currently offline Boy D'Poy
Messages: 56
Registered: October 2011
Member
(semi-)SOLVED (I suppose!)

Since the Servlet/RAP APIs provide session autoclose way and the documentation from AbstractRwtEnvironment

states for AbstractRwtEnvironment#initClientSession(UserAgent)

Quote:

As default, the IClientSession is attached to the http session. This means, the client session lives as long the http session lives. If the http session expires, the client session will be stopped.

This method creates and loads a new client session if there is no client session attached to the http session yet. If there already is one attached, the attached session will be returned.



I simply choosed to override AbstractRwtEnvironment#initClientSession(UserAgent) this way:

@Override
protected IClientSession initClientSession(final UserAgent userAgent) {

	final IClientSession clientSession = super.initClientSession(userAgent);
	// timeout is set to 60 seconds.
	RWT.getSessionStore().getHttpSession().setMaxInactiveInterval(60);
	return clientSession;
}


And all worked fine!

But I don't particulary approve this solution (my own Smile ) because the API states "AS DEFAULT", witch means that, I think, if the tigh conceptual coupling between the Scout IClientSession and the HTTP Session, is lost in a near future, this workouround will also probably be inefficient!


A solution combining, the own Scout's arifacts would be the best, but meanwhile ... this one works Wink !


Once You Go Scout, You Never Come Out!
Re: User (in)activity detection and auto-logout [message #1061275 is a reply to message #1060461] Thu, 30 May 2013 21:45 Go to previous messageGo to next message
Claudio Guglielmo is currently offline Claudio Guglielmo
Messages: 127
Registered: March 2010
Senior Member
Hi Boy

Specifying a session timeout is the right way. If you package your app as war and deploy it on a servlet container (e.g. tomcat), you can set the timeout in the web.xml. I don't know how to do it with jetty, but setting it programmatically with setMaxInactiveInterval is definitely a possibility too.

The UserActivity stuff is not implemented for the rap ui, at least as far as I know.

Regards
Claudio
Re: User (in)activity detection and auto-logout [message #1061339 is a reply to message #1061275] Fri, 31 May 2013 09:41 Go to previous message
Boy D'Poy is currently offline Boy D'Poy
Messages: 56
Registered: October 2011
Member
OK,
Thank you very much! Smile


Once You Go Scout, You Never Come Out!
Previous Topic:scout eclipse features
Next Topic:Marketplace entries?
Goto Forum:
  


Current Time: Tue Sep 30 11:57:09 GMT 2014

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

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