Session timeout is calculated starting from the lastAccessTime of the session.
I have set a session timeout of 20 minutes. A client requests a report. The report is huge, starts displaying immediately in the browser but takes 30 minutes to be completely displayed.
After the report is displayed, now the user clicks on links in the reports to dig further in and gets a session timeout error.
That means the lastAccessTime is not getting updated when the servlet is still writing output to the browser.
Is there a way to update the session lastAccessTime directly from the servlet code ?
I tried setMaxInactiveInterval(), but doesn't solve the problem.
Welcome to the JavaRanch! Please adjust your displayed name to meet the JavaRanch Naming Policy. You can adjust it here.
.... now for your question...
The Servlet 2.3 spec says:
SRV.7.6 Last Accessed Times
The getLastAccessedTime method of the HttpSession interface allows a servlet to determine the last time the session was accessed before the current request. The Session is considered to be accessed when a request that is part of the session is first handled by the servlet container.
So -- knowing that, and the fact that your request takes up to 30 minutes to complete -- you need to increase the session timeout to at least 40 minutes. So, you can either globally set the Session Timeout in your Web Application Deployment Descriptor (web.xml) or you can set it on the fly in your application with setMaxInactiveInterval(int seconds);
Hope that helps!
[ May 09, 2002: Message edited by: Jessica Sant ]
Thanks for the reply.
If I have a time-out set in the server configuation as 20 minutes (since that is what we want to keep for rest of the application), and I use setMaxInactiveInterval() only for one servlet (the one that does huge processing) to make it 40 minutes.
Which one of these time-outs would get preference ?
I am using weblogic 5.1.