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 .