User (in)activity detection and auto-logout [message #1060215] |
Thu, 23 May 2013 14:40 |
Boy D'Poy Messages: 67 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 |
Boy D'Poy Messages: 67 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 ) 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 !
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 |
|
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
|
|
|
|
Powered by
FUDForum. Page generated in 0.04737 seconds