Symbian
 Developer Library

DEVELOPER LIBRARY

[Index] [Glossary] [Previous] [Next]



Location: chttpformencoder.h
Link against: http.lib

Class CHTTPFormEncoder

class CHTTPFormEncoder

Support

Supported from 7.0

Description

A data supplier class for supplying HTTP POST data for HTML form submissions.

The class is used to build up data that is to be URL encoded (MIME type application/x-www-form-urlencoded). A client creates an instance of this class and adds name/value pairs using AddFieldL(). It then uses the object as the data supplier for the body of an HTTP request that is a form submission.

The names and values must be supplied in the correct character encoding that you want to send to the server.

Derivation

CBaseBase class for all classes to be instantiated on the heap
CHTTPFormEncoderA data supplier class for supplying HTTP POST data for HTML form submissions
MHTTPDataSupplierAbstract interface that clients implement to receive response message data from the framework, and to supply request message body data to the framework

Defined in CHTTPFormEncoder:
AddFieldL(), AppendData(), AppendSpecialChar(), CHTTPFormEncoder(), ConstructL(), EAllowAppendData, EDataReleased, ESuppliedSize, ESupplyingData, GetNextDataPart(), IsAlphaNumeric(), NewL(), OverallDataSize(), ReleaseData(), Reset(), THTTPFormEncoderState, iData, iState, ~CHTTPFormEncoder()

Inherited from CBase:
operator new()


Construction and destruction


NewL()

static CHTTPFormEncoder* NewL();

Description

Creates and allocates a new CHTTPFormEncoder.

Return value

CHTTPFormEncoder*

New CHTTPFormEncoder object


~CHTTPFormEncoder()

~CHTTPFormEncoder();

Description

Destructor.

[Top]


Member Functions


GetNextDataPart()

virtual TBool GetNextDataPart(TPtrC8& aDataPart);

Description

Implements the MHTTPDataSupplier interface to supply data parts.

The data is guaranteed to survive until a call is made to ReleaseData().

Parameters

TPtrC8& aDataPart

The data part

Return value

TBool

ETrue if this is the last part, EFalse otherwise


ReleaseData()

virtual void ReleaseData();

Description

Implements the MHTTPDataSupplier interface to release the current data part being held at the data supplier.

This call indicates to the supplier that the part is no longer needed, and another one can be supplied, if appropriate.


OverallDataSize()

virtual TInt OverallDataSize();

Description

Implements the MHTTPDataSupplier interface to obtain the overall size of the data being supplied, if known to the supplier.

Where a body of data is supplied in several parts, this size is the sum of all the part sizes. If the size is not known, KErrNotFound is returned; in this case the caller must use the return code of GetNextDataPart() to find out when the data is complete.

Return value

TInt

A size in bytes, or KErrNotFound if the size is not known.


Reset()

virtual TInt Reset();

Description

Implements the MHTTPDataSupplier interface to reset the data supplier.

This indicates to the data supplier that it should return to the first part of the data. This could be used in a situation where the data consumer has encountered an error and needs the data to be supplied afresh. Even if the last part has been supplied (i.e. GetNextDataPart() has returned ETrue), the data supplier should reset to the first part.

Return value

TInt

If the supplier cannot reset, it should return an error code, otherwise it should return KErrNone, where the reset will be assumed to have succeeded


AddFieldL()

void AddFieldL(const TDesC8& aFieldName, const TDesC8& aFieldValue);

Description

Adds a field to the data.

A field consists of a name and value pair.

Parameters

const TDesC8& aFieldName

A name. This must not be empty.

const TDesC8& aFieldValue

A value. This may be an empty descriptor.

Leave codes

KErrArgument

aFieldName was empty

KErrNoMemory

There was not enough memory

Panic codes

HTTP-CORE 10

No more data can be added, as data has already been supplied or OverallDataSize() has been called

[Top]


Internal members

Description

This is internal and not intended for use.


CHTTPFormEncoder()

private: CHTTPFormEncoder();

Description

This is internal and not intended for use.


ConstructL()

private: void ConstructL();

Description

This is internal and not intended for use.


iState

private: THTTPFormEncoderState iState;

Description

This is internal and not intended for use.


iData

private: HBufC8* iData;

Description

This is internal and not intended for use.


Enum THTTPFormEncoderState

private: THTTPFormEncoderState

Description

This is internal and not intended for use.

EAllowAppendData

This is internal and not intended for use.

ESuppliedSize

This is internal and not intended for use.

ESupplyingData

This is internal and not intended for use.

EDataReleased

This is internal and not intended for use.


IsAlphaNumeric()

private: TBool IsAlphaNumeric(TUint8 aChar);

Description

This is internal and not intended for use.

Parameters

TUint8 aChar

This is internal and not intended for use.

Return value

TBool

This is internal and not intended for use.


AppendSpecialChar()

private: void AppendSpecialChar(TUint8 aChar);

Description

This is internal and not intended for use.

Parameters

TUint8 aChar

This is internal and not intended for use.


AppendData()

private: void AppendData(const TDesC8& aData);

Description

This is internal and not intended for use.

Parameters

const TDesC8& aData

This is internal and not intended for use.