Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

22.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:

//1Adds hdr to an internal list of headers that are attached to a request. In the int library, 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.
//2Formats 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 DocumentContentsIndexNext file

©Copyright 2000, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.