participate


Java Servlet - how to let tomcat destroy a session
<<   Back to Forum  |   Give us Feedback
This topic has 9 replies on 1 page.
fasdhjkfhsdafksdjfks
Posts:53
Registered: 9/1/04
how to let tomcat destroy a session   
Jun 6, 2005 6:47 AM

 
how to let tomcat destroy a session???
 
Saish
Posts:6,785
Registered: 2/23/00
Re: how to let tomcat destroy a session   
Jun 6, 2005 11:19 AM (reply 1 of 9)  (In reply to original post )

 
Out of the box, I believe Tomcat allows you to specify the session timeout. Put the following in your web.xml.

<web-app>
<session-config>
<session-timeout>60</session-timeout>
</session-config>

...
</web-app>


The value is in minutes. After that interval (roughly), the user's session will be invalidated.

- Saish
 
serlank
Posts:951
Registered: 6/7/01
Re: how to let tomcat destroy a session   
Jun 7, 2005 1:09 AM (reply 2 of 9)  (In reply to #1 )

 
... or if you would like to do it programmaticaly you can call invalidate() on the session object.
 
Stefan@CrazyCustomer
Posts:1
Registered: 12/1/06
Re: how to let tomcat destroy a session   
Dec 1, 2006 1:26 AM (reply 3 of 9)  (In reply to #1 )

 
Since Tomcat 5.5 this seems not to work any more ...
 
cynic061
Posts:38
Registered: 12/30/04
Re: how to let tomcat destroy a session   
Aug 22, 2007 3:12 AM (reply 4 of 9)  (In reply to #3 )

 
Since Tomcat 5.5 this seems not to work any more ...

You mean session.invalidate() doesnot work or the web.xml configuration doesnot work in tomcat 5.5

sNkr
 
totalz
Posts:38
Registered: 8/4/05
Re: how to let tomcat destroy a session   
Jun 3, 2008 2:55 AM (reply 5 of 9)  (In reply to #4 )

 
cynic061 wrote:
Since Tomcat 5.5 this seems not to work any more ...

You mean session.invalidate() doesnot work or the web.xml configuration doesnot work in tomcat 5.5

sNkr

I'm testing with Tomcat6, it seems session.invalidate() does not work!!
 
BalusC
Posts:29,784
Registered: 4/26/06
Re: how to let tomcat destroy a session   
Jun 3, 2008 6:52 AM (reply 6 of 9)  (In reply to #5 )

 
It works perfectly. Your interpretation is just wrong.

In the future please respond to active topics only and don't resurrect old topics.
 
totalz
Posts:38
Registered: 8/4/05
Re: how to let tomcat destroy a session   
Jun 3, 2008 6:39 PM (reply 7 of 9)  (In reply to #6 )

 
BalusC wrote:
It works perfectly. Your interpretation is just wrong.

In the future please respond to active topics only and don't resurrect old topics.



Please tell how my interpretation is wrong.

If you don't people to reply to old threads, please lock them.

And if you want to help, I'm actually waiting for your reply on Session invalidate() in Tomcat 6.
 
cowboy
Posts:9
Registered: 7/3/08
Re: how to let tomcat destroy a session   
Aug 12, 2008 1:38 AM (reply 8 of 9)  (In reply to original post )

 
i'm using this:


HttpSession htpSess=request.getSession();
if(htpSess!=null){
htpSess.invalidate();
Enumeration e= htpSess.getAttributeNames();
while(e.hasMoreElements()){
String key=(String)e.nextElement();
htpSess.setAttribute(key,null);
}
}
 
BalusC
Posts:29,784
Registered: 4/26/06
Re: how to let tomcat destroy a session   
Aug 12, 2008 4:51 AM (reply 9 of 9)  (In reply to #8 )

 
Just HttpSession#invalidate() is enough.

No need to resurrect this thread for.
 
This topic has 9 replies on 1 page.
Back to Forum
 
Read the Developer Forums Code of Conduct

Click to email this message Email this Topic

Edit this Topic
  
 
 
Forums Statistics
    Users Online : 29
  • Guests : 132

About Sun forums
  • Sun Forums is a large collection of user generated discussions. It is here to help you ask questions, find answers, and participate in discussions.

    Check out our guide on Getting started with Sun Forums for a full walkthrough of how to best leverage the benefits of this community.

Powered by Jive Forums