CHeaderCodec Class Reference

#include <mw/http/framework/cheadercodec.h>

class CHeaderCodec : public CBase

Inherits from

Detailed Description

An abstract HTTP header codec.

Each instance of a concrete subclass of CHeaderCodec is associated with, and owned by, a specific CProtocolHandler. It provides on-demand encoding/decoding of HTTP header data, between the generic format used by clients/filters to formulate requests and interpret responses, and the raw format used by the transport handlers (and origin servers/gateways/etc.)

The CHeaderCodec has an associated instance of a sub-class of each of CHeaderReader and CHeaderWriter. It delegates the actual encoding and decoding function to these instances.

Header codecs provide a mechanism for extensibility whereby if one codec can't decode (or encode) a given header, it locates a codec that can, and then delegates the task to that codec instead.

Member Attribute Documentation

iReader

CHeaderReader *iReader[protected]

The owned header reader object that does actual decoding of header fields.

iWriter

CHeaderWriter *iWriter[protected]

The owned header writer object that does actual encoding of header fields.

Constructor & Destructor Documentation

CHeaderCodec ( )

IMPORT_CCHeaderCodec()[protected]

Default constructor.

~CHeaderCodec ( )

IMPORT_C~CHeaderCodec()[virtual]

Intended Usage: Destructor - cleans up and releases resources to the system.

Member Function Documentation

CanDecode ( RStringF )

TBool CanDecode(RStringFaHeaderField)const [pure virtual]

Intended Usage: Concrete header codec classes must implement this method to indicate to the framework whether their concrete CHeaderReader is capable of decoding the named header field.

Parameters
aHeaderField(in) A proxy for the header field to be encoded
Return Value
A flag indicating ETrue if the field can be decoded.

CanEncode ( RStringF )

TBool CanEncode(RStringFaHeaderField)const [pure virtual]

Intended Usage: Concrete header codec classes must implement this method to indicate to the framework whether their concrete CHeaderWriter is capable of encoding the named header field.

Parameters
aHeaderField(in) A proxy for the header field to be encoded
Return Value
A flag indicating ETrue if the field can be encoded.

ConstructL ( )

IMPORT_C voidConstructL()[protected]

Second phase construction in which any necessary allocation is done Implementations of this interface may leave with standard erros like KErrNoMemory if there is insufficient memory for allocation in the second phase.

DecodeHeaderL ( RHeaderField & )

IMPORT_C voidDecodeHeaderL(RHeaderField &aHeader)const

Decode the supplied header field. This method uses the associated concrete CHeaderReader object to do a conversion of the field into the generic internal representation from the raw form.

Parameters
aHeader(in) A proxy for the header field to be decoded
Leave Codes
KErrNotSupportedif a codec that supports decoding this header cannot be found

EncodeHeaderL ( RHeaderField & )

IMPORT_C voidEncodeHeaderL(RHeaderField &aHeader)const

Encode the supplied header field. This method uses the associated concrete CHeaderWriter object to do a conversion of the field into raw form from the generic internal representation.

Parameters
aHeader(in) A proxy for the header field to be encoded
Leave Codes
KErrNotSupportedif a codec that supports encoding this header cannot be found

FindDelegateCodecL ( RStringF )

CHeaderCodec *FindDelegateCodecL(RStringFaHeaderField)const [pure virtual]

Intended Usage: Concrete header codecs must be implement this method if they wish to delegate the encoding/decoding of particular header fields to a different codec. This would be done if the codec doesn't have the ability itself to do the encode/decode but can locate an alternative that does. This function may leave with a Standard Symbian OS error code. eg. KErrNoMemory

The caller takes ownership of the returned codec.
Parameters
aHeaderField(in) A proxy for the header field to be encoded
Return Value
A pointer to the new CHeaderCodec, or NULL if one couldn't be found.
Leave Codes
KErrNoMemory,Not enough memory to create object.