A.4. Handling the Client Request: HTTP Request Headers
Methods That Read Request Headers
These are all methods in HttpServletRequest.
public String getHeader(String headerName)
Returns value of an arbitrary header. Returns null if header not in request.
public Enumeration getHeaders(String headerName)
Returns values of all occurrences of header in request. 2.2 only.
public Enumeration getHeaderNames()
Returns names of all headers in current request.
public long getDateHeader(String headerName)
Reads header that represents a date and converts it to Java date format (milliseconds since 1970).
public int getIntHeader(String headerName)
Reads header that represents an integer and converts it to an int. Returns -1 if header not in request. Throws NumberFormatException ...
Get Core Servlets and JavaServer Pages™ now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.