• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

methods would you use to retrive header values from request

 
Satyajeet Kadam
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Following is a question from Manning Book
page 65
question 7
Q Which of the following methods would you use to retrive header values from request (select two)

a getHeader() of ServletRequest
b getHeaderValues() of ServletRequest
c getHeader() of HttpServletRequest
d getHeaders() of ServletRequest
e getHeaders() of HttpServletRequest

Ans:b nad e


I think c and e are correct.
b is wrong.

I think there is no getHeaderValues()in ServletRequest. I referring tomcat 4.1 docs.


java.util.Enumeration getHeaders(java.lang.String name)
Returns all the values of the specified request header as an Enumeration of String objects.


java.lang.String getHeader(java.lang.String name)
Returns the value of the specified request header as a String.


Please correct me if i an wrong.
 
Mirko Bonasorte
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to be really sure of this, always refer to java api:
Java 2 Enterprise Edition 1.4
 
Satyajeet Kadam
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is not such method getHeaderValues()in API under HttpServletrequest.
 
Atul Sawant
Ranch Hand
Posts: 304
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Damn....i always get shot on this question!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic