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.
SCJP 1.4, SCWCD, SCBCD, IBM XML, IBM Websphere 285, IBM Websphere 287