17 October 2010

0 How to Access HTTP Request Header in Java?

Accessing Request Header in Java


In Java, HTTP request headers can be accessed by the following methods of the HttpServletRequest interface.
  • getHeaderNames
  • getHeader
  • getHeaders
     To access the value of a header associated with a given name getHeader() is used. In case there are multiple values associated with a given name getHeaders() is used such as cachecontrol header. getHeaders() returns an enumeration of the string object associate with a given header name. If getHeader() is used to access the header having multiple values then the first value will be returned.


0 comments:

Feeds Comments

Please give your valuable comments.