Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Internet Protocols Module User's Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

B.4 HTTP Headers

Starting with HTTP version 1.0, requests and responses can accommodate header fields, which consist of a field name followed by a colon, a single space, and the value associated with the field. Detailed information is in RFC 1945, which is available at the Web sites listed in the bibliography.

Class RWIHttpMethod, which is the base class of all HTTP commands, provides methods to include header information as part of a command request. They are:

//1

Adds hdr to an internal list of headers that are attached to a request. In the Internet Protocols package, a series of header helper classes are provided as a convenience for some common header fields. They are RWIHttpGenericHeader, RWIHttpDateHeader, RWIHttpFromHeader, RWIHttpIfModifiedSinceHeader, RWIHttpUserAgentHeader, and RWIHttpContentLengthHeader for generic, Date, From, If-Modified-Since, User-Agent, and Content-Length headers respectively. Note that some of these header classes can also be used in responses and body description.

//2

Formats the passed-in data as label: value, and adds the result to an internal list of headers attached to a request. This method lets you insert any header field in the internal header list. No validity check is performed.

The following sample code demonstrates how headers can be constructed as part of an HTTP GET request.



Previous fileTop of DocumentContentsIndex pageNext file

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

The Rogue Wave name and logo, and SourcePro, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.