|
1 /* |
|
2 * Copyright (c) 2002-2005 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: Header description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 #ifndef SEN_HTTP_CHANNEL_H |
|
29 #define SEN_HTTP_CHANNEL_H |
|
30 |
|
31 // INCLUDES |
|
32 #include <e32base.h> // for CBase |
|
33 |
|
34 #include "senresponseobserver.h" |
|
35 #include "MSenElement.h" |
|
36 |
|
37 //FORWARD DECLARATION |
|
38 class MSenIdentityManager; |
|
39 class CSenSoapEnvelope2; |
|
40 class CSenAtomEntry; |
|
41 class CSenLayeredHttpTransportProperties; |
|
42 |
|
43 |
|
44 // CLASS DECLARATION |
|
45 |
|
46 /** |
|
47 * The class for submitting multiple simultaneous HTTP requests. |
|
48 * Accept header and User-Agent header have to be set before |
|
49 * the class is used. You should call the set methods only after |
|
50 * construction, not after any requests are submitted. |
|
51 * |
|
52 */ |
|
53 |
|
54 class CSenHttpChannel : public CBase |
|
55 { |
|
56 public: |
|
57 enum TPanics |
|
58 { |
|
59 ENoAcceptHeader = 1, |
|
60 ENoUserAgentHeader, |
|
61 EAddedHeadersCount, |
|
62 ETxnStateNull, |
|
63 ERequestUriNull, |
|
64 EPostContentTypeNull, |
|
65 EPostContentNull, |
|
66 ERespBodyNull, |
|
67 EContentTypeUnrecognisedValueType |
|
68 }; |
|
69 |
|
70 public: // Constructors and destructor |
|
71 /** |
|
72 * Two-phased constructor. |
|
73 */ |
|
74 static CSenHttpChannel* NewL(MSenIdentityManager& aManager); |
|
75 |
|
76 /** |
|
77 * Two-phased constructor. |
|
78 */ |
|
79 static CSenHttpChannel* NewLC(MSenIdentityManager& aManager); |
|
80 |
|
81 static CSenHttpChannel* NewL(MSenIdentityManager& aManager, |
|
82 TUint32 aIapId); |
|
83 |
|
84 static CSenHttpChannel* NewLC(MSenIdentityManager& aManager, |
|
85 TUint32 aIapId); |
|
86 // New functions |
|
87 |
|
88 /** |
|
89 * Submit HTTP POST request to a given URI with the given |
|
90 * content type and the message body. Observer is called |
|
91 * when the response is ready. The method leaves if an |
|
92 * error occurs. |
|
93 * @param aObserver observer is called when the response |
|
94 * @param aUri outgoing request URI. |
|
95 * @param aContent outgoing request content. |
|
96 * @param aProps outgoing transport properties for the |
|
97 * submitted message. |
|
98 * @return submit id which identifies the request. |
|
99 */ |
|
100 virtual TInt SendL(MSenResponseObserver& aObserver, |
|
101 const TDesC8& aUri, |
|
102 const TDesC8& aContent, |
|
103 CSenLayeredHttpTransportProperties& aProps) = 0; |
|
104 |
|
105 |
|
106 virtual TInt SendL(MSenResponseObserver& aObserver, |
|
107 const TDesC8& aUri, |
|
108 CSenSoapEnvelope2& aContent, |
|
109 CSenLayeredHttpTransportProperties& aProps) = 0; |
|
110 virtual TInt SendL(MSenResponseObserver& aObserver, |
|
111 const TDesC8& aUri, |
|
112 CSenAtomEntry& aContent, |
|
113 CSenLayeredHttpTransportProperties& aProps) = 0; |
|
114 |
|
115 virtual TInt SendL(MSenResponseObserver& aObserver, |
|
116 const TDesC8& aUri, |
|
117 const RFile& aFile, |
|
118 CSenLayeredHttpTransportProperties& aProps) = 0; |
|
119 |
|
120 /** |
|
121 * Set web proxy to be used when sending requests. |
|
122 * If you try to connect with the phone emulator to the Internet |
|
123 * from Nokia Intranet you need to set this. Internally, this |
|
124 * method will call the version, which takes in the complete |
|
125 * proxy address: |
|
126 * @see SetProxyL(const TDesC8& aProxyAddrStr) |
|
127 * |
|
128 * @param aProxyHostBaseAddr, e.g. 172.19.160.50 |
|
129 * @param aProxyPort, e.g. 8080. Note that, if a negative value |
|
130 * is provided, then the HTTP port is not used in forming of |
|
131 * the host address. In such case, the default proxy port |
|
132 * value of HTTP stack implemtation will be used. |
|
133 */ |
|
134 virtual void SetProxyL(const TDesC8& aProxyHostBaseAddr, |
|
135 TInt aProxyPort) = 0; |
|
136 /** |
|
137 * Set web proxy to be used when sending requests. |
|
138 * If you try to connect with the phone emulator to the Internet |
|
139 * from Nokia Intranet you need to set this. |
|
140 * |
|
141 * @param aProxyAddrStr proxy address, e.g. 131.228.55.140:8080. |
|
142 */ |
|
143 virtual void SetProxyL(const TDesC8& aProxyAddrStr) = 0; |
|
144 |
|
145 /** |
|
146 * By default HTTP v. 1.1 is used. If you want to set |
|
147 * set HTTP 1.0 call SetHttpVersionL(0). |
|
148 * |
|
149 * @param aVersion HTTP version, give x for HTTP 1.x. |
|
150 */ |
|
151 virtual void SetHttpVersionL(TInt aVersion) = 0; |
|
152 |
|
153 virtual void SetProxyUsageL(TBool aProxyUsage) = 0; |
|
154 virtual void SetSecureDialogL(TBool aSecureDialog) = 0; |
|
155 virtual TBool EffectiveIapId(TUint32 &aIapId) = 0; |
|
156 virtual TInt CancelTransaction(const TInt aTxnId) = 0; |
|
157 virtual void CancelAllTransactions() = 0; |
|
158 virtual void EnableTimeOutL(TInt aTxnId, TInt aTimeOutSec) = 0; |
|
159 virtual void DisableTimeOutL(TInt aTxnId) = 0; |
|
160 virtual TInt32 UsedIap() = 0; |
|
161 |
|
162 }; |
|
163 |
|
164 #endif // SEN_HTTP_CHANNEL_H |
|
165 |
|
166 // End of File |