Monday, 27 June 2016

How to retrieve HTTP request header information ?


Methods of HttpServletRequest interface
  • getHeader : returns a header value by given header name
    If there are multiple headers with the same name, it returns the first head in the request.
  • getHeaders : returns all the header values associated with the given header name (Enumeration of Strings)
  • getHeaderNames : returns names of all the headers
  • getIntHeader : returns header value (String) into int format
    If it cannot translate the header value to an int, a NumberFormatException is thrown.
  • getDateHeader : returns header value (String) into Date format
    If it cannot translate the header to a Date object, an IllegalArgumentException is thrown.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.