SourcePro® 2022.1 |
SourcePro® API Reference Guide |
Helper class that defines an HTTP Content-Type header. More...
#include <rw/http/RWHttpContentTypeHeader.h>
Public Member Functions | |
RWHttpContentTypeHeader (void) | |
RWHttpContentTypeHeader (const RWCString &mediaType, const RWCString &subType) | |
RWHttpContentTypeHeader (const RWHttpGenericHeader &hdr) | |
bool | addParameter (const RWCString &name, const RWCString &value) |
RWCString | getMediaType (void) const |
RWTValSlist< RWCString > | getParameterNames (void) const |
RWCString | getParameterValue (const RWCString &name) const |
RWCString | getSubType (void) const |
RWCString | getValue (void) const |
bool | removeParameter (const RWCString &name) |
void | setContentType (const RWCString &mediaType, const RWCString &subType) |
Public Member Functions inherited from RWHttpHeaderBase | |
virtual bool | append (const RWCString &str) |
virtual RWCString | asString (void) const |
RWCString | getLabel (void) const |
RWHttpHeaderType | getType () const |
bool | operator!= (const RWHttpHeaderBase &) const |
bool | operator< (const RWHttpHeaderBase &hdr) const |
bool | operator== (const RWHttpHeaderBase &h) const |
Additional Inherited Members | |
Static Public Member Functions inherited from RWHttpHeaderBase | |
static unsigned | hash (const RWHttpHeaderBase &) |
Protected Member Functions inherited from RWHttpHeaderBase | |
RWHttpHeaderBase (void) | |
RWHttpHeaderBase (const RWCString &label, RWHttpHeaderType type=RW_HTTP_ENTITY_HEADER) | |
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.
|
inline |
Constructs a default RWHttpContentTypeHeader object with the label Content-Type
and the value text/plain
.
RWHttpContentTypeHeader::RWHttpContentTypeHeader | ( | const RWCString & | mediaType, |
const RWCString & | subType | ||
) |
Constructs an RWHttpContentTypeHeader with the label Content-Type
and the value mediaType / subType.
RWHttpContentTypeHeader::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.
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.
RWCString RWHttpContentTypeHeader::getMediaType | ( | void | ) | const |
Returns the media type of this instance.
RWTValSlist<RWCString> RWHttpContentTypeHeader::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.
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.
RWCString RWHttpContentTypeHeader::getSubType | ( | void | ) | const |
Returns the sub type of this instance.
|
virtual |
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.
Implements RWHttpHeaderBase.
bool RWHttpContentTypeHeader::removeParameter | ( | const RWCString & | name | ) |
Removes the parameter associated with name from the parameter list. If the parameter is not present, false
is returned.
Copyright © 2022 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |