|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE concept |
|
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
|
12 <concept id="GUID-A88F4A4E-49D7-4F92-8047-CA287C54B964" xml:lang="en"><title>Transaction |
|
13 Properties</title><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <p>Transaction properties are accessed using the <xref href="GUID-2E673024-239B-3965-8880-C47B7CC24EF6.dita#GUID-2E673024-239B-3965-8880-C47B7CC24EF6/GUID-88CFB38B-9E3F-389A-B020-F2E62A09998F"><apiname>RHTTPTransaction::PropertySet()</apiname></xref> method, |
|
15 which returns an <xref href="GUID-C23D0EDB-E024-35AD-97E9-88FB6DC0EC7E.dita"><apiname>RHTTPTransactionPropertySet</apiname></xref> handle. They |
|
16 are used to store information related to a transaction that is required to |
|
17 persist during the transaction lifetime. Such information is not transmitted; |
|
18 the mechanism only provides an association, mainly used by Symbian developers |
|
19 for filter. </p> |
|
20 <p>The two pre-defined properties that can be set by the client are <xref href="GUID-7BB3CFA5-4697-305D-B4FD-D8747BB56E04.dita#GUID-7BB3CFA5-4697-305D-B4FD-D8747BB56E04/GUID-C9F345D9-C713-3C99-AFEE-1292D1EB61D9"><apiname>HTTP::EUsername</apiname></xref> and <xref href="GUID-7BB3CFA5-4697-305D-B4FD-D8747BB56E04.dita#GUID-7BB3CFA5-4697-305D-B4FD-D8747BB56E04/GUID-A803D500-6EED-35BE-B0CB-B01B2150B1CC"><apiname>HTTP::EPassword</apiname></xref>. |
|
21 Their use is described in <xref href="GUID-AA2A730E-A7C9-5647-AD42-11C3BAF4C38D.dita#GUID-AA2A730E-A7C9-5647-AD42-11C3BAF4C38D/GUID-8DB0C8B3-4ED6-59D6-A796-F4EA2DE5DC5B">Validation |
|
22 filter</xref>. </p> |
|
23 <p>An example of properties in use is taken from the Redirection filter, where |
|
24 a count is maintained of the number of redirections made in response to 300-series |
|
25 HTTP status codes: </p> |
|
26 <codeblock id="GUID-4B3457B6-9B5C-551A-B830-4D839E01BACE" xml:space="preserve">// see if this transaction has been redirected before |
|
27 THTTPHdrVal redirectCountProperty; |
|
28 if (aTransaction.PropertySet().Property(p.StringF(HTTP::ERedirectCount,RHTTPSession::GetTable()), |
|
29 redirectCountProperty)) |
|
30 { |
|
31 __ASSERT_DEBUG(redirectCountProperty.Type() == THTTPHdrVal::KTIntVal, HTTPPanic::Panic(HTTPPanic::EHeaderInvalidType)); |
|
32 redirectCount = redirectCountProperty.Int(); |
|
33 __ASSERT_DEBUG(redirectCount > 0, HTTPPanic::Panic(HTTPPanic::EHeaderInvalidType)); |
|
34 } |
|
35 |
|
36 // Only redirect a certain number of times, and update the redirect count property of the transaction |
|
37 if (++redirectCount < KRedirectLimit) |
|
38 aTransaction.PropertySet().SetPropertyL(p.StringF(HTTP::ERedirectCount,RHTTPSession::GetTable()), redirectCount);</codeblock> |
|
39 </conbody></concept> |