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

attribute scopes

 
cyril vidal
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
a question extracteed from j2eecertificate.com

Which of the following attribute scopes are thread-safe? [Check all correct answers]


The correct answer is:
1. Request attribute.
2. Response attribute.
3. Session attribute.
4. Context attribute.
5. None of the above.

Feedback:
Answers 1 and 2 are correct. The request attribute and response attribute are thread-safe because the servlet container creates a single HttpServletRequest and a single HttpServletResponse per request. Therefore both attributes are only available for that request and hence cannot be shared by other requests.


To my sense, answer 2 should not be considered as exact here.
It's true that HttpServletResponse object is thread-safe, but HttpServletResponse is not an attribute scope. Or the question asks for atribute scopes...
What do you think? It's difficult to cut it short, isn't it?
Regards,
Cyril.
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, cyril vidal... U r right.. Response attribute is not an attribute scope...
And also I'm wondering whether they wanna ask about the object? HttpServletRequest Object, HttpServletResponse Object, HttpSession Object and ServletContext Object...
What do u think?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic