• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setMaxInactiveInterval() and session-timeout

 
Sayak Banerjee
Ranch Hand
Posts: 292
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does setMaxInactiveInterval()(programmatically) get the priority over <session-timeout>(declaritive in DD) for that specific session if both are mentioned?

I couldn't find this in the spec....if anyone does, could you please post the page number?

Thanks in advance.
[ December 19, 2006: Message edited by: Sayak Banerjee ]
 
muthu moorthy
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Configuring time out in the DD is for every session that's created.

If we want to change the session time out value for a particular session instance (without affecting the time out length for any other session in the app), we should use session.setMaxInactiveInterval(seconds)

Hope the second sentence visibly means this will succeed
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To answer your question, yes, it gets the priority.
The one in the DD will be set at startup. Calling setMaxInactiveInterval will overwrite it.
 
Manikandan Jayaraman
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Very simple to remember and very logical too ...

Local variables of a method take precedence as compared to Instance variables of the same name ...

Similarly, The session that you acquire in your servlet is the local one AND the one in the DD is the global one, so setMaxInactiveInterval gets the priority.
 
Sayak Banerjee
Ranch Hand
Posts: 292
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks every one
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic