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

Question from Marcus green

 
Charmy Madhvani
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which of the following statements are true?
Choose at least one answer. a. Once an ServletRequest attribute has been set, it is visible to all subsequent requests
b. Data in a HttpSession attribute will not be available if the web server restarts
c. Data in the ServletContext can be shared by any servlet of the same web application.
d. The getParameter method of HttpSession will retrieve a session attribute

I answered both b and c but the correct one is only c. b is incorrect for following reason:Although session attribute data may dissapear if Tomcat is restarted, this is not guaranteed behaviour and some web servers may store session data in a database.

Which web server stores the session attribute even after restarted? And whats the point in retaining the session data once the session is invalidated?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Containers like Tomcat offers the possibility to persist/reload sessions when the server is shutdown/started. This is enabled by default.
 
Marcus Green
arch rival
Rancher
Posts: 2813
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The exam tests on the standard, not the reference implementation. In theory you could be running an implementation that does not persist sessions between resets of the server. I doubt however if this relatively arcane point is covered by the exam, so I wouldn't worry too much about it and perhaps I should change the question.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic