File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet Timeout in two ways

 
Anant Jagania
Ranch Hand
Posts: 49
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

There are two ways of setting session time-out for servlet. one is giving in web.xml and another is setting the Inactive interval by calling setMaxInactiveInterval on HttpSession.

What are the conceptual differences between these two ways?

Regards,
Anant
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no conceptual difference, as both settings affect the same parameter. The one in web.xml is used if setMaxInactiveInterval is not called.
[ March 15, 2007: Message edited by: Ulf Dittmer ]
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Be careful that the parameter for setMaxInactiveInterval is expressed in seconds, whereas the one in the deployment descriptor is in minutes.
 
Sunil Vasudevan
Ranch Hand
Posts: 107
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is one more difference.

When we configure session timeout in web.xml, it is applicable to all the sessions created.

When we call setMaxInactiveInterval(int interval) on a session object, then the timeout is set only for that specific session object.

If you have specified a timeout value in web.xml and also calling setMaxInactiveInterval(int interval) on a session object, then for that session object, value set in setMaxInactiveInterval() will be considered for timeout.
 
Anant Jagania
Ranch Hand
Posts: 49
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks all. i understood the difference..
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic