|
1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Definition of HttpPostDataSupplier |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef HTTPPOSTDATASUPPLIER_H |
|
19 #define HTTPPOSTDATASUPPLIER_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32base.h> |
|
23 #include <http/mhttpdatasupplier.h> |
|
24 #include <http/RHTTPTransaction.h> |
|
25 #include <wtf/vector.h> |
|
26 |
|
27 // CONSTANTS |
|
28 |
|
29 // MACROS |
|
30 |
|
31 // DATA TYPES |
|
32 |
|
33 // FUNCTION PROTOTYPES |
|
34 |
|
35 // FORWARD DECLARATIONS |
|
36 namespace WebCore { |
|
37 class FormData; |
|
38 }; |
|
39 |
|
40 class PostDataItem; |
|
41 class CBrCtl; |
|
42 |
|
43 // CLASS DECLARATION |
|
44 |
|
45 /** |
|
46 * Data supplier for POST request body. |
|
47 * |
|
48 * @lib resloader.lib |
|
49 * @since 3.1 |
|
50 */ |
|
51 class HttpPostDataSupplier :public MHTTPDataSupplier |
|
52 { |
|
53 public: // Constructors |
|
54 |
|
55 /** |
|
56 * Construct. |
|
57 * @since 3.1 |
|
58 * @param aData Post body. |
|
59 * @param aDataLen Post body length. |
|
60 * @return |
|
61 */ |
|
62 HttpPostDataSupplier(RHTTPTransaction* transaction, CBrCtl* brctl); |
|
63 |
|
64 void initL(WebCore::FormData* formData); |
|
65 |
|
66 //destructor |
|
67 ~HttpPostDataSupplier(); |
|
68 |
|
69 public: // Functions from base classes |
|
70 |
|
71 /** |
|
72 * Release data. |
|
73 * @since 3.1 |
|
74 * @param |
|
75 * @return void |
|
76 */ |
|
77 void ReleaseData(); |
|
78 |
|
79 /** |
|
80 * Get body length. |
|
81 * @since 3.1 |
|
82 * @param |
|
83 * @return The length of the body. |
|
84 */ |
|
85 TInt OverallDataSize(); |
|
86 |
|
87 /** |
|
88 * Get the body in one chunk. |
|
89 * @since 3.1 |
|
90 * @param aDataPart A pointer to be set to the data body and length. |
|
91 * @return ETrue |
|
92 */ |
|
93 TBool GetNextDataPart( TPtrC8& aDataPart ); |
|
94 |
|
95 /** |
|
96 * Since we don't stream requests, there is nothing to reset. |
|
97 * @since 3.1 |
|
98 * @param |
|
99 * @return KErrNone |
|
100 */ |
|
101 TInt Reset(); |
|
102 private: |
|
103 /** |
|
104 * Get the body in one chunk. |
|
105 * @since 3.1 |
|
106 * @param aDataPart A pointer to be set to the data body and length. |
|
107 * @return ETrue |
|
108 */ |
|
109 void getNextDataPartL( TPtrC8& aDataPart ); |
|
110 |
|
111 |
|
112 private: // Data |
|
113 |
|
114 RHTTPTransaction* m_transaction; // not owned |
|
115 Vector<PostDataItem*> m_postData; // owned |
|
116 HBufC8* m_dataPart;// owned , part data |
|
117 int m_totalSize;// total size of the post data |
|
118 int m_postItemIndex;// post data items track |
|
119 int m_refCount; |
|
120 bool m_lastPart; |
|
121 CBrCtl* m_brctl; |
|
122 bool m_firstPart; |
|
123 }; |
|
124 |
|
125 #endif // HTTPPOSTDATASUPPLIER_H |
|
126 |
|
127 // End of File |