Module: Internet Protocols Module Package: HTTP
RWHttpContentTypeHeader RWHttpHeaderBase
addParameter() getMediaType() getParameterNames() |
getParameterValue() getSubType() getValue() |
removeParameter() RWHttpContentTypeHeader() setContentType() |
#include <rw/http/RWHttpContentTypeHeader.h>
RWHttpContentTypeHeader is a specialization class of RWHttpHeaderBase. It is a helper class that formats its contents as Content-Type: header_value, where header_value is the media type and sub type of the message, as well as any parameters describing the content.
RWHttpContentTypeHeader hdr("text", "plain"); hdr.addParameter("charset", "iso-2022-jp");
RWHttpContentTypeHeader();
Constructs a default RWHttpContentTypeHeader object with the label Content-Type and the value text/plain.
RWHttpContentTypeHeader(const RWCString& mediaType, const RWCString& subType);
Constructs an RWHttpContentTypeHeader with the label ContentType and the value mediaType/subType.
RWHttpContentTypeHeader(const RWHttpGenericHeader& hdr);
Constructs an RWHttpContentTypeHeader object from an RWHttpGenericHeader that represents a Content-Type header. If the RWHttpGenericHeader does not represent a Content-Type header or if the value of the RWHttpGenericHeader does not conform to the formatting of a Content-Type value, an RWHttpHeaderParseError exception is thrown.
void setContentType(const RWCString& mediaType, const RWCString&
subType);
Sets the mediaType and subType of this instance.
RWCString getMediaType(void) const;
Returns the mediaType of this instance.
RWCString getSubType(void) const;
Returns the subType of this instance.
RWCString getValue(void) const;
Returns the value of this header as an RWCString. This includes the media and sub types, as well as any parameters associated with the header, formatted according the HTTP specification's requirements.
bool addParameter(const RWCString& name, const RWCString& value);
Add a parameter to this header. If the parameter is not currently associated with this instance, the parameter will be added, and true will be returned, false otherwise.
bool removeParameter(const RWCString& name);
Removes the parameter associated with name from the parameter list. If the parameter is not present, false is returned.
RWCString getParameterValue(const RWCString& name) const;
Returns the value associated with a parameter associated with this instance. If the name does not match a parameter in the list, an empty string is returned.
RWTValSlist<RWCString> getParameterNames(void) const;
Returns a list of parameter names associated with this instance. The values associated with these parameter names can be retrieved with the getParameterValue method.
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.