|
1 /* |
|
2 * Copyright (c) 2007-2008 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 "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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_NCDSENDHTTPREQUESTOPERATION_H |
|
20 #define C_NCDSENDHTTPREQUESTOPERATION_H |
|
21 |
|
22 #include "ncdbaseoperation.h" |
|
23 #include "ncdoperationobserver.h" |
|
24 #include "catalogsconnectionmethod.h" |
|
25 |
|
26 |
|
27 class MCatalogsHttpOperation; |
|
28 class CCatalogsHttpRequestAdapter; |
|
29 class TNcdConnectionMethod; |
|
30 class CNcdGeneralManager; |
|
31 |
|
32 /** |
|
33 * Creates a HTTP transaction from a standard HTTP request data |
|
34 * |
|
35 */ |
|
36 class CNcdSendHttpRequestOperation : |
|
37 public CNcdBaseOperation, |
|
38 public MCatalogsHttpObserver |
|
39 { |
|
40 public: |
|
41 |
|
42 /** |
|
43 * NewL |
|
44 * |
|
45 * @param aUri Request URI. Ownership is transferred. NULL is not allowed |
|
46 * @param aRequest Request data. Ownership is transferred. NULL is not allowed |
|
47 */ |
|
48 static CNcdSendHttpRequestOperation* NewL( |
|
49 HBufC8* aUri, |
|
50 HBufC8* aRequest, |
|
51 const TNcdConnectionMethod& aMethod, |
|
52 CNcdGeneralManager& aGeneralManager, |
|
53 MNcdOperationRemoveHandler& aRemoveHandler, |
|
54 MCatalogsHttpSession& aHttpSession, |
|
55 MCatalogsSession& aSession ); |
|
56 |
|
57 |
|
58 /** |
|
59 * Destructor |
|
60 */ |
|
61 virtual ~CNcdSendHttpRequestOperation(); |
|
62 |
|
63 |
|
64 public: // From MCatalogsHttpObserver |
|
65 |
|
66 /** |
|
67 * @see MCatalogsHttpObserver::HandleHttpEventL() |
|
68 */ |
|
69 void HandleHttpEventL( |
|
70 MCatalogsHttpOperation& aOperation, |
|
71 TCatalogsHttpEvent aEvent ); |
|
72 |
|
73 /** |
|
74 * @see MCatalogsHttpObserver::HandleHttpError() |
|
75 */ |
|
76 TBool HandleHttpError( |
|
77 MCatalogsHttpOperation& aOperation, |
|
78 TCatalogsHttpError aError ); |
|
79 |
|
80 |
|
81 public: // From CNcdBaseOperation |
|
82 |
|
83 /** |
|
84 * @see CNcdBaseOperation::Cancel() |
|
85 */ |
|
86 void Cancel(); |
|
87 |
|
88 |
|
89 /** |
|
90 * @see CNcdBaseOperation::ReceiveMessage() |
|
91 */ |
|
92 void ReceiveMessage( |
|
93 MCatalogsBaseMessage* aMessage, |
|
94 TInt aFunctionNumber ); |
|
95 |
|
96 |
|
97 protected: // From CNcdBaseOperation |
|
98 |
|
99 |
|
100 /** |
|
101 * @see CNcdBaseOperation::RunOperation() |
|
102 */ |
|
103 TInt RunOperation(); |
|
104 |
|
105 protected: |
|
106 |
|
107 // Constructor |
|
108 CNcdSendHttpRequestOperation( |
|
109 CNcdGeneralManager& aGeneralManager, |
|
110 MNcdOperationRemoveHandler& aRemoveHandler, |
|
111 MCatalogsHttpSession& aHttpSession, |
|
112 MCatalogsSession& aSession ); |
|
113 |
|
114 void ConstructL( |
|
115 const TNcdConnectionMethod& aMethod, |
|
116 HBufC8* aUri, |
|
117 HBufC8* aRequest ); |
|
118 |
|
119 |
|
120 void HandleStateL(); |
|
121 |
|
122 TBool HandleError( TInt aError ); |
|
123 |
|
124 void GetResponseL( MCatalogsBaseMessage& aMessage ); |
|
125 |
|
126 private: |
|
127 |
|
128 MCatalogsHttpSession& iHttpSession; |
|
129 MCatalogsHttpOperation* iTransaction; |
|
130 |
|
131 HBufC8* iUri; |
|
132 HBufC8* iRequest; |
|
133 HBufC8* iResponse; |
|
134 TCatalogsConnectionMethod iConnectionMethod; |
|
135 CCatalogsHttpRequestAdapter* iAdapter; |
|
136 CBufFlat* iBody; |
|
137 }; |
|
138 |
|
139 #endif // C_NCDSENDHTTPREQUESTOPERATION_H |