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 time out

 
mathew john
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is not Tomcat specific.
I'll move this to our Servlets forum for you.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out Tomcat's default web.xml, the session timeout is set to 30 minutes.
 
mathew john
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Ben ,

Thanks a lot ,just what i was looking for :-)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic