A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Refactoring for Software Design Smells: Managing Technical Debt
this week in the
OO, Patterns, UML and Refactoring
Web Component Certification (SCWCD/OCPJWCD)
Question about "getHeaderValue()"
Malika Ben Aziz
Joined: Oct 26, 2009
Aug 16, 2010 09:25:57
I am preparing for SCWCD using the book SCWCD EXAM STUDY KIT 2nd edition (SCE 310-081).
On the chapter about
, there is a response for a question that did not convince me.
7. Which of the following methods would you use to retrieve header values from a request? (Select two) a getHeader() of ServletRequest [b]b getHeaderValue() of ServletRequest //??? [/b]c getHeader() of HttpServletRequest d getHeaders() of ServletRequest e getHeaders() of HttpServletRequest Answers: b and e Explanation Headers are a feature of the HTTP protocol. Thus, all the header-specific methods belong to HttpServletRequest. getHeader() returns a String (or null), while getHeaders() returns an Enumeration of all the values for that header (or an empty Enumeration).
the explanation seems correct, but the answer is not.
I didn't find any thing about headers on the ServletRequest interface.
To me correct answer would be just "e"
Can you confirm please?
Joined: Jan 20, 2010
Aug 16, 2010 10:26:56
Yes you are right , the answer will be c and e
When you are in doubt then refer the specs and take them as the last say.
| Pursuing Bachelor of Engineering | OSUM Club Leader | SCJP 6 | SCWCD 5 |...
Have you checked out
subject: Question about "getHeaderValue()"
doubt from hanumant book
[JSP 2.0] Final Version errors. Part 2.
getHeaders(s) or getHeaderValues(s)?
methods would you use to retrive header values from request
GetHeaders for only one value
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015