Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getHeaders(s) or getHeaderValues(s)?

 
Bruce Jin
Ranch Hand
Posts: 672
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Anthony Villanueva
Ranch Hand
Posts: 1055
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 672
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.
It looks like my book is wrong.
 
Louise Haydu
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic