• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Logout Problems

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have got a problem. Any suggestions/tips are welcome.
I have to restrict number of log-in's .
Hence when a user logs in and quits by closing the browser without logging off, I need to be notified so that i can do some database activity such as reducing the active session.
I tried using HttpSessionBindingListener it didnt work properly, i was notified when i inValidated the session but didnt when closed the browser.
As a temporary solution i am running a timer at backend so the session live till the time i specify some seconds.
Any alternate suitable would of great help and thanks in advance
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Forget about figuring out when a user has logged off. In a web context, there's not enough visual feedback to let him/her know. They can pop over to eBay and come back again and still be logged on. Then there's the problem of the "Blue screen" type of logoff, which (obviously!) isn't going to give you feedback! And of course, some hacker would find a way to exploit it anyway (NEVER trust control information sent from a client!).
Your server may not be advanced enough to support the feature you want - end-of-session detection is a recent addition provided because everyone else ran into the same sort of problem.
If you can, upgrade, if not, I think you're solving the problem the right way.
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could try..
httpSession.setMaxInactiveInactiveInterval(int millisecs);
or get the httpSession.getLastAccessedTime() compare it with current time and invalidate session if the time in milliseconds is greater that certain time limit..
Thanks
Srikanth
 
reply
    Bookmark Topic Watch Topic
  • New Topic