my dog learned polymorphism*
The moose likes Servlets and the fly likes  getHeaders(s) or getHeaderValues(s)? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark " getHeaders(s) or getHeaderValues(s)?" Watch " getHeaders(s) or getHeaderValues(s)?" New topic
Author

getHeaders(s) or getHeaderValues(s)?

Bruce Jin
Ranch Hand

Joined: Sep 20, 2001
Posts: 666
my Servlet 2.3 API only lists request.getHeaders() but one of my book (Deshmukh SCWCD study) only lists request.getHeaderValues().
Is the book wrong?


BJ - SCJP and SCWCD
We love Java programming. It is contagious, very cool, and lot of fun. - Peter Coad, Java Design

Crazy Bikes created by m-Power
Anthony Villanueva
Ranch Hand

Joined: Mar 22, 2002
Posts: 1055
When in doubt, check the specs

SRV.4.3 Headers
A servlet can access the headers of an HTTP request through the following methods of the HttpServletRequest interface:
• getHeader
• getHeaders
• getHeaderNames
The getHeader method returns a header given the name of the header. There can be multiple headers with the same name, e.g. Cache-Control headers, in an HTTP request. If there are multiple headers with the same name, the getHeader method returns the first head in the request. The getHeaders method allows access to all the header values associated with a particular header name, returning an Enumeration of String objects.
Bruce Jin
Ranch Hand

Joined: Sep 20, 2001
Posts: 666
Thanks.
It looks like my book is wrong.
Louise Haydu
Ranch Hand

Joined: Aug 17, 2000
Posts: 51
Errata has been published for the book at www.manning.com/deshmukh. Also be sure to check out the author's online forum for errors that haven't yet been incorporated into the errata page.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getHeaders(s) or getHeaderValues(s)?