• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

session doubt

 
Ranch Hand
Posts: 237
MyEclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
MyEclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes seetharaman is right ,

Now programatically, session will never expire if negative value is given to setMaxInactiveInterval().
 
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The difference was introduced to add spice for certification exams like scwcd .
 
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
 
Ranch Hand
Posts: 531
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're using programmatic values? Shame on you. Never! Use declarative, and consider yourself lucky.
 
Power corrupts. Absolute power xxxxxxxxxxxxxxxx is kinda neat.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic