Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Effect of setMaxInactiveInterval(0)

 
Nidhi Sar
Ranch Hand
Posts: 252
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to the note on page 249 of HFSJ, the effect of setMaxInactiveInterval(0) is that the session times out IMMEDIATELY

According to JEE6 API,

void setMaxInactiveInterval(int interval)
Specifies the time, in seconds, between client requests before the servlet container will invalidate this session.
An interval value of zero or less indicates that the session should never timeout.


According to JEE5 API,

void setMaxInactiveInterval(int interval)
Specifies the time, in seconds, between client requests before the servlet container will invalidate this session.
A negative time indicates the session should never timeout.

Note: Nothing about zero in here.

So my question is, in the current exam, what would be the correct answer to the question "what is the effect of setMaxInactiveInterval(0) on the session?"
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2447
96
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nidhi,
So my question is, in the current exam, what would be the correct answer to the question "what is the effect of setMaxInactiveInterval(0) on the session?"


This is what is written in the servlet2.4 spec (SCWCD5):
SRV.7.5 Session Timeouts
This timeout can be changed by the Developer using the setMaxInactiveInterval method of the HttpSession interface. The timeout periods used by these methods are defined in seconds. By definition, if the timeout period for a session is set to -1, the session will never expire.

There is nothing about 0, because if you think about it: it effectively means expire after 0 seconds.

Regards,
Frits
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic