rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWHttpContentTypeHeader Class Reference
[HTTP]

Helper class that defines an HTTP Content-Type header. More...

#include <rw/http/RWHttpContentTypeHeader.h>

Inheritance diagram for RWHttpContentTypeHeader:
RWHttpHeaderBase

List of all members.

Public Member Functions

 RWHttpContentTypeHeader (void)
 RWHttpContentTypeHeader (const RWCString &mediaType, const RWCString &subType)
 RWHttpContentTypeHeader (const RWHttpGenericHeader &hdr)
void setContentType (const RWCString &mediaType, const RWCString &subType)
RWCString getMediaType (void) const
RWCString getSubType (void) const
RWCString getValue (void) const
bool addParameter (const RWCString &name, const RWCString &value)
bool removeParameter (const RWCString &name)
RWCString getParameterValue (const RWCString &name) const
RWTValSlist< RWCStringgetParameterNames (void) const

Detailed Description

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.

Examples

 RWHttpContentTypeHeader hdr("text", "plain");
 hdr.addParameter("charset", "iso-2022-jp");

Constructor & Destructor Documentation

RWHttpContentTypeHeader::RWHttpContentTypeHeader ( void   )  [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 ContentType 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.


Member Function Documentation

bool RWHttpContentTypeHeader::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.

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.

RWCString RWHttpContentTypeHeader::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.

RWCString RWHttpContentTypeHeader::getSubType ( void   )  const

Returns the sub type of this instance.

RWCString RWHttpContentTypeHeader::getValue ( void   )  const [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.

void RWHttpContentTypeHeader::setContentType ( const RWCString mediaType,
const RWCString subType 
)

Sets the mediaType and subType of this instance.

 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

© 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.