tomcat 4 session timeout

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sameer

    #1

    tomcat 4 session timeout

    Hello All,

    I have a simple JSP which looks like this

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
    <%@ page session="true"% >
    <HTML>
    <HEAD>
    <meta HTTP-EQUIV="refresh" CONTENT="35">
    <META http-equiv=Cache-Control content=no-cache>
    <META http-equiv=Pragma content=no-cache>
    </HEAD>
    <BODY>
    <%
    Object sessionIterator AsObj = null;
    int sessionIterator ;
    sessionIterator AsObj = session.getValu e("sessionItera tor");
    if (sessionIterato rAsObj == null) {
    sessionIterator = 0;
    } else {
    Integer tmpInteger = (Integer) sessionIterator AsObj;
    sessionIterator = tmpInteger.intV alue();
    }
    sessionIterator ++;
    out.println("<p >" + new java.util.Date( ) + " <p>");
    out.println("Se ssion = " + session);
    out.println("<p >session accessed '" +sessionIterato r+ "' times.</p>");
    out.println("<p >Max session idle time in secs = "
    +session.getMax InactiveInterva l()+ "</p>");
    session.putValu e("sessionItera tor", new Integer(session Iterator)); %>
    </BODY> </HTML>

    This page accesses the session every time it is invoked. The session timeout
    is set to 60 seconds. What I have observed is that, If the page refresh
    interval is set to less than 30 seconds, then session lives for a long time,
    but if it is longer then session is dropped frequently.

    Does this mean, it is not sufficient to access session only once during
    timeout period to avoid timeout? I was under the impression that tomcat 4
    would restart the 60 seconds timer after every access to session.

    Thanks,
    Sameer.
Working...