wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes is session id from cookie? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "is session id from cookie?" Watch "is session id from cookie?" New topic
Author

is session id from cookie?

Ranjani Theyagarajan
Greenhorn

Joined: Feb 08, 2006
Posts: 19
what will be returned by the method isRequestedSessionIdFromCookie(); if the session has been already invalidated?

will it throw illegalStateException or will it return false?

The spec is not talking about this...
P Chittaranjan
Ranch Hand

Joined: Feb 09, 2006
Posts: 47
Hi ,

If you are creating the session object, whether you invalidate it or not isRequestedSessionIdFromCookie will return true.
If you are not creating the HttpSession object, you will get false.

It will not throw any exception.

Thanks
Chittaranjan


Thanks,<br />Chittaranjan<br />SCJP 5.0,SCWCD1.4,SCBCD 5
Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026

isRequestedSessionIdFromCookie();


is a HttpServletRequest method and NOT HttpSession method. So you don't have to worry whether the session has been invalidated or NOT.

I found a similar interesting question regarding HttpSession.

Which of the following methods will NOT cause an error if invoked after session has been invalidated.

1. getCreationTime()
2. isNew()
3. getServletContext()
4. setMaxInactiveInterval(int interval)


If you observe closely you can figure out option 3 would be the right choice.


Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
P Chittaranjan
Ranch Hand

Joined: Feb 09, 2006
Posts: 47
option 3 and 4 are the right choices.
Satish Ramasamy
Greenhorn

Joined: Feb 13, 2006
Posts: 15
You guys are scaring me.

I am reading HFSJ for the second time and I didn't come across this method isRequestedSessionIdFromCookie() in the book.

Please advice whether I should refer some other book also for the exam. I thought that this book would provide every detail to score 100%.

I do read the Specification but I don't concentrate on methods/details that are not there in HFSJ book, assuming they won't be asked in the exam. Please advice whether I am doing the correct thing for scoring 100%(only from the exam perspective, though I understand that scoring 100% doesn't mean that I know a to z in Servlets/JSP).


Thanks,<br />Satish<br /> <br />SCJP 1.4 - 98%
 
Consider Paul's rocket mass heater.
 
subject: is session id from cookie?
 
Similar Threads
Alternative to Cookie?
Field set in action method coming null in JSP
Session problem in NetBeans
Advice on persisting complex state across multiple server trips
ASP