GeeCON Prague 2014*
The moose likes Servlets and the fly likes Session time out Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "Session time out " Watch "Session time out " New topic
Author

Session time out

mathew john
Greenhorn

Joined: Dec 14, 2004
Posts: 19
hi ,

i am not sure this is a tomcat problem or not ,
i have set a session time out in my webapplication in web.xml for 30 minutes.

But just before the session times out i need to delete a file on the server .

is it possible.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

It is not Tomcat specific.
I'll move this to our Servlets forum for you.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Read up on the HttpSessionListener.
Your scenario is exactly what it was created for.
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpSessionListener.html
Naresh Waswani
Greenhorn

Joined: Jun 02, 2006
Posts: 5
there is a httpsessionlistener interface. you can create a class that implements that interface.

there is a callback method in that interface that you jus implement and whenever the session is destroyed , this method automatically gets called.

you can write the file deletion code in this method.

hope it works.

regards

Naresh Waswani
9986461501
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Check out Tomcat's default web.xml, the session timeout is set to 30 minutes.


[My Blog]
All roads lead to JavaRanch
mathew john
Greenhorn

Joined: Dec 14, 2004
Posts: 19
hi Ben ,

Thanks a lot ,just what i was looking for :-)
 
GeeCON Prague 2014
 
subject: Session time out