aspose file tools*
The moose likes Servlets and the fly likes session timeout - need a handle to execute code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "session timeout - need a handle to execute code" Watch "session timeout - need a handle to execute code" New topic
Author

session timeout - need a handle to execute code

pendse anagha
Ranch Hand

Joined: Mar 09, 2005
Posts: 44
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

Joined: Dec 11, 2004
Posts: 13410

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.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
pendse anagha
Ranch Hand

Joined: Mar 09, 2005
Posts: 44
Thanks Ben ,
Eagerly awaiting your feedback - since I really need to resolve this issue.

Thanks once again
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

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

Joined: Dec 11, 2004
Posts: 13410

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 ]
 
 
subject: session timeout - need a handle to execute code