Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
HydraExpress Servlet Development Guide

7.3 Inspecting HTTP Headers

A rwsf::HttpServletRequest contains the headers transmitted with the client's original HTTP request. The servlet request provides the function getHeader() for retrieving the value associated with a given header. For example, the code sample below retrieves the value of the Referer HTTP header:

If the request from the client does not contain a Referer header, getHeader() returns an empty string.

Some request headers may contain more than one value. For those headers, the getHeader() function returns the first value. To retrieve the complete set of values, use the getHeaders() function. The code sample below retrieves the list of values contained in the Accept HTTP header:

If the request from the client does not contain an Accept header, the enumeration contains no elements. If the Accept header contains only one value, the enumeration contains one element.

To retrieve the names of the headers in the request, use the getHeaderNames() function. The line of code below retrieves a list of the headers that the request contains:



Previous fileTop of DocumentContentsNo linkNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo are registered trademarks of Rogue Wave Software, and HydraExpress is a trademark of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.