106 |
106 |
107 aSelf->iTransactionClient = CHttpTransactionClient::NewL(aSelf->iSessionClient, aSelf, aUri, aRequestMethod); |
107 aSelf->iTransactionClient = CHttpTransactionClient::NewL(aSelf->iSessionClient, aSelf, aUri, aRequestMethod); |
108 } |
108 } |
109 |
109 |
110 void NativeHttpTransaction::SubmitL(JNIEnv* aJni, jobject* /*aPeer*/,const jobjectArray aHeaders, const jbyteArray aPostData, const jint aPostDataLength, |
110 void NativeHttpTransaction::SubmitL(JNIEnv* aJni, jobject* /*aPeer*/,const jobjectArray aHeaders, const jbyteArray aPostData, const jint aPostDataLength, |
111 int aResponseTimeout) |
111 int aResponseTimeout, jboolean aPartialDataFlag) |
112 { |
112 { |
113 |
113 |
114 //retrieve the headers |
114 //retrieve the headers |
115 RPointerArray<HBufC8> rawHeaderArray; |
115 RPointerArray<HBufC8> rawHeaderArray; |
116 CleanupStack::PushL(TCleanupItem(CleanUpResetAndDestroy,&rawHeaderArray)); |
116 CleanupStack::PushL(TCleanupItem(CleanUpResetAndDestroy,&rawHeaderArray)); |
158 |
158 |
159 int arrayhandle = reinterpret_cast<int>(&rawHeaderArray); |
159 int arrayhandle = reinterpret_cast<int>(&rawHeaderArray); |
160 |
160 |
161 int hbufhandle = reinterpret_cast<int>(postBuf); |
161 int hbufhandle = reinterpret_cast<int>(postBuf); |
162 |
162 |
163 CallMethodL(this, &NativeHttpTransaction::ExecuteSubmitL,handle,arrayhandle , hbufhandle, aResponseTimeout, iFuncServer); |
163 CallMethodL(this, &NativeHttpTransaction::ExecuteSubmitL,handle,arrayhandle , hbufhandle, aResponseTimeout, aPartialDataFlag, iFuncServer); |
164 if (postBuf!=NULL) |
164 if (postBuf!=NULL) |
165 { |
165 { |
166 delete postBuf; |
166 delete postBuf; |
167 postBuf = NULL; |
167 postBuf = NULL; |
168 } |
168 } |
169 |
169 |
170 |
170 |
171 CleanupStack::PopAndDestroy();//rawHeaderArray; |
171 CleanupStack::PopAndDestroy();//rawHeaderArray; |
172 } |
172 } |
173 |
173 |
174 void NativeHttpTransaction::ExecuteSubmitL(int aSelfhandle , int aRawHeadershandle , int aPostBufhandle, int aResponseTimeout) |
174 void NativeHttpTransaction::ExecuteSubmitL(int aSelfhandle , int aRawHeadershandle , int aPostBufhandle, int aResponseTimeout, bool aPartialDataFlag) |
175 { |
175 { |
176 |
176 |
177 NativeHttpTransaction *aSelf = reinterpret_cast<NativeHttpTransaction*>(aSelfhandle); |
177 NativeHttpTransaction *aSelf = reinterpret_cast<NativeHttpTransaction*>(aSelfhandle); |
178 RPointerArray<HBufC8>* aRawHeaders = reinterpret_cast<RPointerArray<HBufC8>*>(aRawHeadershandle); |
178 RPointerArray<HBufC8>* aRawHeaders = reinterpret_cast<RPointerArray<HBufC8>*>(aRawHeadershandle); |
179 HBufC8* aPostBuf = reinterpret_cast<HBufC8*>(aPostBufhandle); |
179 HBufC8* aPostBuf = reinterpret_cast<HBufC8*>(aPostBufhandle); |
180 |
180 |
181 aSelf->iTransactionClient->SubmitL(aRawHeaders, aPostBuf, aResponseTimeout); |
181 aSelf->iTransactionClient->SubmitL(aRawHeaders, aPostBuf, aResponseTimeout, aPartialDataFlag); |
182 } |
182 } |
183 |
183 |
184 jobjectArray NativeHttpTransaction::GetResponseL(JNIEnv* aJni) |
184 jobjectArray NativeHttpTransaction::GetResponseL(JNIEnv* aJni) |
185 { |
185 { |
186 jobjectArray objArray=NULL; |
186 jobjectArray objArray=NULL; |
271 session->doReadCallback(aStatus,iJniPeer); |
271 session->doReadCallback(aStatus,iJniPeer); |
272 |
272 |
273 LOG(ESOCKET,EInfo,"-NativeHttpTransaction::DataReadyForRead"); |
273 LOG(ESOCKET,EInfo,"-NativeHttpTransaction::DataReadyForRead"); |
274 } |
274 } |
275 |
275 |
|
276 void NativeHttpTransaction::DoPostCallBack() |
|
277 { |
|
278 LOG(ESOCKET,EInfo,"+NativeHttpTransaction::DoPostCallBack"); |
|
279 |
|
280 NativeHttpSession* session = reinterpret_cast<NativeHttpSession*>(iFuncServer); |
|
281 session->doDataConsumedCallback(iJniPeer); |
|
282 |
|
283 LOG(ESOCKET,EInfo,"-NativeHttpTransaction::DoPostCallBack"); |
|
284 |
|
285 } |
|
286 |
276 void NativeHttpTransaction::ExecuteCloseTransaction(int aSelfhandle) |
287 void NativeHttpTransaction::ExecuteCloseTransaction(int aSelfhandle) |
277 { |
288 { |
278 NativeHttpTransaction *aSelf = reinterpret_cast<NativeHttpTransaction*>(aSelfhandle); |
289 NativeHttpTransaction *aSelf = reinterpret_cast<NativeHttpTransaction*>(aSelfhandle); |
279 aSelf->iTransactionClient->CloseTransaction(); |
290 aSelf->iTransactionClient->CloseTransaction(); |
280 } |
291 } |
307 handle = reinterpret_cast<int>(security); |
318 handle = reinterpret_cast<int>(security); |
308 } |
319 } |
309 return handle; |
320 return handle; |
310 } |
321 } |
311 |
322 |
|
323 int NativeHttpTransaction::PostDataL(JNIEnv* aJni,const jbyteArray aPostData, const jint aPostDataLength, const jboolean iEndOfRequest) |
|
324 { |
|
325 |
|
326 HBufC8* postBuf=NULL; |
|
327 TInt ret = 0; |
|
328 if (aPostDataLength>KErrNone) |
|
329 { |
|
330 postBuf=HBufC8::NewLC(aPostDataLength); |
|
331 TPtr8 bufPtr = postBuf->Des(); |
|
332 User::LeaveIfError(S60CommonUtils::CopyToNative(*aJni , aPostData , 0 , aPostDataLength , bufPtr)); |
|
333 CleanupStack::Pop(postBuf); |
|
334 } |
|
335 int handle = reinterpret_cast<int>(this); |
|
336 int hbufhandle = reinterpret_cast<int>(postBuf); |
|
337 CallMethodL(ret, this,&NativeHttpTransaction::ExecutePostDataL,handle, hbufhandle, iEndOfRequest, iFuncServer); |
|
338 return KErrNone; |
|
339 } |
|
340 |
|
341 TInt NativeHttpTransaction::ExecutePostDataL(int aSelfhandle, int aPostBufhandle, bool iEndOfRequest) |
|
342 { |
|
343 |
|
344 NativeHttpTransaction *aSelf = reinterpret_cast<NativeHttpTransaction*>(aSelfhandle); |
|
345 HBufC8* aPostBuf = reinterpret_cast<HBufC8*>(aPostBufhandle); |
|
346 aSelf->iTransactionClient->PostDataL(aPostBuf , iEndOfRequest); |
|
347 |
|
348 |
|
349 return KErrNone; |
|
350 } |
|
351 |
312 /* |
352 /* |
313 * Returns the amount of bytes avaible for read in our buffer. |
353 * Returns the amount of bytes avaible for read in our buffer. |
314 */ |
354 */ |
315 TInt NativeHttpTransaction::Available() |
355 TInt NativeHttpTransaction::Available() |
316 { |
356 { |