Wednesday 30 July 2014

Accessing Headers

HttpServletRequest interface provides below methods to access headers.

    getHeader(String name)
    getHeaderNames()
    getHeaders(String name)

getHeader method returns the value of the specified request header as a String. There can be multiple headers with same name, if there are multiple headers with the same name, the getHeader returns the first header in the request.

The getHeaders method allows access to all the values associated with this header name.

Headers my contain string representation of integer and date. HttpServlet provides methods getIntHeader(String name) to get the integer value and getDateHeader(String name) to get the date as long value.


Prevoius                                                 Next                                                 Home

No comments:

Post a Comment