Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

session timeout - need a handle to execute code

 
pendse anagha
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ranchers ,
Need your help !

The requirement:
I do not want the same user to again login to my application
ie if User X is already logged in - he should not be allowed
to login again

My solution :
I have used application context by making use of ServletContext
This works where everytime I check if the user is present or not

The problem :

1 >When the user does not explicitly logout there are two other
ways in which user could come out of the application :

a > User could close the browser ( I think here I can handle
the situation by invoking a servlet through Java script )

b > PLEASE HELP HERE -
What happens if the user remains inactive for about 2 hours
( In web.xml ) the session timeout is set to 30 minutes

Now - I am facing the problem - I need a way to access
the servlet context object on session timeout ( user inactive > 30 minutes )

If I could get a handle to this event being fired - I think I could potentially clean the application context of the specific user's info .

I think I should be using HttpSessionListener object .
Is this correct ?
Also - I know I am being lazy - but if someone could point me to an actual example of how to go about implementing this - I could then get a better understanding .

Thanks for everyones patience .
-anagha
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This issue was disuscussed at great length a few weeks ago (maybe longer).
I would take a little time to search the servlet and JSP forum archives. There were a lot of different ideas thrown around.

I said then and I still maintain that the internet is not a reliable enough platform for per seat licensing.
 
pendse anagha
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ben ,
Eagerly awaiting your feedback - since I really need to resolve this issue.

Thanks once again
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What I meant is that you should search this and the JSP forums.
This issue was discussed at length and many ideas were offered and debated.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://www.coderanch.com/t/360305/Servlets/java/Session-Handling-restrict-only-one

There was a very similar thread in the JSP forum not too long ago.
[ June 12, 2005: Message edited by: Ben Souther ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic