set session timeout in code.tomcat


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 9 of 9

Thread: set session timeout in code.tomcat

  1. #1
    Join Date
    Mar 2004
    Location
    malaysia
    Posts
    150

    set session timeout in code.tomcat

    How to set session timeout in code for tomcat?

  2. #2
    Join Date
    Dec 2005
    Location
    New Jersey
    Posts
    290

  3. #3
    Join Date
    Mar 2004
    Location
    malaysia
    Posts
    150
    I want to set it in runtime not in web.xml

  4. #4
    Join Date
    Dec 2005
    Posts
    21
    if you're using Servlets, when implementing doGet method...

    Code:
    public void doGet(HttpServletRequest req, ... {
       ...
       HttpSession session = req.getSession();
       session.setMaxInterval(60); // 60 seconds
       ...
    }

  5. #5
    Join Date
    Mar 2004
    Location
    malaysia
    Posts
    150
    i want to set to all user who alrady get he session. Set the session time out to whole appilcation. Thanks.

  6. #6
    Join Date
    Dec 2005
    Posts
    21
    I'm not sure what you mean. All users should have session, and .getSession() will get the current session if they already have one... whoa looks like a typo'd there...

    it should have been:

    session.setMaxInactiveInterval();

  7. #7
    Join Date
    Mar 2004
    Location
    malaysia
    Posts
    150
    Actually, my purpose is to kick all the users go out. even it get the session already. I just set the session time out to 1 then all the user will easily get kick. So how to set all the session in one time?

  8. #8
    Join Date
    Dec 2005
    Posts
    21
    I'm not sure, but I suspect that there's no direct way to set the timeout for all current users for security reasons. However, there's nothing stopping you from storing all the sessions you control in a synchronized collection, then iterating through it and changing all the timeouts.

  9. #9
    Join Date
    Mar 2004
    Location
    malaysia
    Posts
    150
    Then where to find out all the session. Where it store?

Similar Threads

  1. SQL DMO Restores in VB?
    By ObiWan in forum VB Classic
    Replies: 3
    Last Post: 05-23-2006, 10:35 AM
  2. Getting a GUI to run
    By Eric in forum Java
    Replies: 4
    Last Post: 04-14-2006, 09:09 AM
  3. urgent: session timeout occurs unexpectedly
    By seemagaur in forum ASP.NET
    Replies: 1
    Last Post: 01-26-2006, 09:24 AM
  4. Session Variables Not Being Set
    By Jennifer in forum ASP.NET
    Replies: 2
    Last Post: 01-16-2002, 06:30 PM
  5. How do I detect an FTP timeout?
    By Julian Milano in forum VB Classic
    Replies: 2
    Last Post: 08-11-2000, 12:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center