my dog learned polymorphism*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Session:JWeb+ Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Session:JWeb+" Watch "Session:JWeb+" New topic
Author

Session:JWeb+

Vikrama Sanjeeva
Ranch Hand

Joined: Sep 02, 2001
Posts: 756
Question ID :996258797686
In which of the following situations a session will definitely be invalidated?
ANS:2nd & 3rd options.(not mentioning here...)
However its 4th option is wrong which is.....

if the session time out is set to 0, the session will never be invalidated automatically.

In explanation of this 4th option JWebPlus says..

The value is -1 & not 0!

But when i refer to specification, i got the following...

The session-timeout element defines the default session timeout interval for all sessions created in this web application. The specified timeout must be expressed in a whole number of minutes.If the timeout is 0 or less, the container ensures the default behaviour of sessions is never to time out.

What to do?.Am i missing some thing??
Bye.
Viki.


Count the flowers of your garden, NOT the leafs which falls away!
Prepare IBM Exam 340 by joining http://groups.yahoo.com/group/IBM340Exam/
Paul Anilprem
Enthuware Software Support
Ranch Hand

Joined: Sep 23, 2000
Posts: 3285
    
    7
SRV 7.5 (Last line):
By definition, if the timeout period for a session is set to -1, the session will never expire.


Enthuware - Best Mock Exams and Questions for Oracle/Sun Java Certifications
Quality Guaranteed - Pass or Full Refund!
Paul Anilprem
Enthuware Software Support
Ranch Hand

Joined: Sep 23, 2000
Posts: 3285
    
    7
Ok, looks like there is an inconsistancy in the spec. itself. In SRV 13.3, in the description of <session-timeout>, it says, "If the timeout is 0 or less...".

I think, "0 or less" applies to web.xml, while "-1" applies to the setMaxInactiveInterval() method.
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
Paul:
I couldn't agree with you more. Please see our previous discussion on the subject, we do have an example.
regds.
- satya


Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
Scott Ramsey
Greenhorn

Joined: Jun 28, 2001
Posts: 16
As I understand it, there are two issues here.
1. Setting the <session-timeout> element in web.xml to zero or less means that the default for ALL sessions in the web app is to never expire.
2. Programmatically calling HttpSession.setMaxInactiveInterval() with any negative integer will set this SPECIFIC session to never expire. (Previous thread's testing seems to show that making this call with zero as the integer time's out the session as soon as it is created.)
Not an inconsistency, just a difference in scope.
[ February 28, 2002: Message edited by: Scott Ramsey ]

Scott<br />-----------------<br />SCJP, SCJD, SCWCD<br />XML, UML, WLS6.0
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
Not an inconsistency, just a difference in scope
While, the difference in scope (one servlet verses all servlets) is agreed, you need to note the inconsistency in the use of a session-timeout value of "0" zero.
When used in the web-app, the session will never invalidate. On the other hand when used in the setMaxInactivveInterval(0) method, it invalidates the session immediately (well, almost).
Hope you see the inconsistency.
regds.
- satya
Scott Ramsey
Greenhorn

Joined: Jun 28, 2001
Posts: 16
Agreed. Hastily worded reply is my error.
I was trying to address the confusion between the web.xml element's effects and that of the method call on the session itself.
But, regardless of scope, it sure would have made our lives a little bit easier if the rule was just to always use a negative integer, etc.
Hey, perhaps we can see this as increased job security!
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
increased job security
okay, now that is a sensitive issue, don't even drag me into that..... :roll:
- satya........end of transmission on this issue!!!
Vikrama Sanjeeva
Ranch Hand

Joined: Sep 02, 2001
Posts: 756

When used in the web-app, the session will never invalidate. On the other hand when used in the setMaxInactivveInterval(0) method, it invalidates the session immediately (well, almost).


Thats the difference..
Bye.
Viki.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Session:JWeb+