Transaction Properties

Transaction properties are accessed using the RHTTPTransaction::PropertySet() method, which returns an RHTTPTransactionPropertySet handle. They are used to store information related to a transaction that is required to persist during the transaction lifetime. Such information is not transmitted; the mechanism only provides an association, mainly used by Symbian developers for filter.

The two pre-defined properties that can be set by the client are HTTP::EUsername and HTTP::EPassword . Their use is described in Validation filter .

An example of properties in use is taken from the Redirection filter, where a count is maintained of the number of redirections made in response to 300-series HTTP status codes:

      
       
      
      // see if this transaction has been redirected before
THTTPHdrVal redirectCountProperty;
if (aTransaction.PropertySet().Property(p.StringF(HTTP::ERedirectCount,RHTTPSession::GetTable()), 
redirectCountProperty))
    {
    __ASSERT_DEBUG(redirectCountProperty.Type() == THTTPHdrVal::KTIntVal, HTTPPanic::Panic(HTTPPanic::EHeaderInvalidType));
    redirectCount = redirectCountProperty.Int();
    __ASSERT_DEBUG(redirectCount > 0, HTTPPanic::Panic(HTTPPanic::EHeaderInvalidType)); 
    }

// Only redirect a certain number of times, and update the redirect count property of the transaction
if (++redirectCount < KRedirectLimit)
    aTransaction.PropertySet().SetPropertyL(p.StringF(HTTP::ERedirectCount,RHTTPSession::GetTable()), redirectCount);