Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

session doubt

 
sudheer kiran
Ranch Hand
Posts: 237
Firefox Browser MyEclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<session-config>
<session-timeout>0</session-timeout>
</session-config>

and

session.setMaxinActiveInterval(0);

both are same or different?
setting 0 thru DD will cause session never to expire
setting thru program will cause session to expire immidiately.is this correct?
 
raja ram
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Yes, both are same. Whatever you declare in DD will be returned by the getMaxInactiveInterval method. both DD and setMaxInactiverInterval will behave in same way as long as the value is same if different then Programmatic values will always override DD values.

Thanks
 
sudheer kiran
Ranch Hand
Posts: 237
Firefox Browser MyEclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if both are same then why dont their behavour is same

when we set 0 thru DD ,session never expires
when v set 0 thru program it expires immidiately.
 
Gaurav Gambhir
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The values specified in Deployment Descriptor for <session-timeout> is always in minutes

and setMaxInactiveInterval() method accepts value in seconds.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by sudheer kiran:

setting 0 thru DD will cause session never to expire
setting thru program will cause session to expire immidiately.is this correct?


correct

Originally posted by raja ram:
Yes, both are same.


No.
 
Gaurav Gambhir
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes seetharaman is right ,

Now programatically, session will never expire if negative value is given to setMaxInactiveInterval().
 
Deepak Jain
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The difference was introduced to add spice for certification exams like scwcd .
 
Sandeep Bhandari
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Gaurav Gambhir:
The values specified in Deployment Descriptor for <session-timeout> is always in minutes

and setMaxInactiveInterval() method accepts value in seconds.


I would remember it like:
DD is for long term perspective and if you need longer session timeout interval (i.e. minutes) go for it.

But if your session is short lived, you can set it progrmatically (i.e. seconds)
 
Anton Golovin
Ranch Hand
Posts: 527
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're using programmatic values? Shame on you. Never! Use declarative, and consider yourself lucky.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic