javacommons/gcfprotocols/http/src.s60/nativehttptraansaction.cpp
changeset 80 d6dafc5d983f
parent 50 023eef975703
--- a/javacommons/gcfprotocols/http/src.s60/nativehttptraansaction.cpp	Mon Oct 04 11:29:25 2010 +0300
+++ b/javacommons/gcfprotocols/http/src.s60/nativehttptraansaction.cpp	Fri Oct 15 12:29:39 2010 +0300
@@ -108,7 +108,7 @@
 }
 
 void NativeHttpTransaction::SubmitL(JNIEnv* aJni, jobject* /*aPeer*/,const jobjectArray aHeaders, const jbyteArray aPostData, const jint aPostDataLength,
-                                    int aResponseTimeout)
+                                    int aResponseTimeout, jboolean aPartialDataFlag)
 {
 
     //retrieve the headers
@@ -160,7 +160,7 @@
 
     int hbufhandle = reinterpret_cast<int>(postBuf);
 
-    CallMethodL(this, &NativeHttpTransaction::ExecuteSubmitL,handle,arrayhandle , hbufhandle, aResponseTimeout, iFuncServer);
+    CallMethodL(this, &NativeHttpTransaction::ExecuteSubmitL,handle,arrayhandle , hbufhandle, aResponseTimeout, aPartialDataFlag, iFuncServer);
     if (postBuf!=NULL)
     {
         delete postBuf;
@@ -171,14 +171,14 @@
     CleanupStack::PopAndDestroy();//rawHeaderArray;
 }
 
-void NativeHttpTransaction::ExecuteSubmitL(int aSelfhandle , int aRawHeadershandle , int aPostBufhandle, int aResponseTimeout)
+void NativeHttpTransaction::ExecuteSubmitL(int aSelfhandle , int aRawHeadershandle , int aPostBufhandle, int aResponseTimeout, bool aPartialDataFlag)
 {
 
     NativeHttpTransaction *aSelf = reinterpret_cast<NativeHttpTransaction*>(aSelfhandle);
     RPointerArray<HBufC8>* aRawHeaders = reinterpret_cast<RPointerArray<HBufC8>*>(aRawHeadershandle);
     HBufC8* aPostBuf = reinterpret_cast<HBufC8*>(aPostBufhandle);
 
-    aSelf->iTransactionClient->SubmitL(aRawHeaders, aPostBuf, aResponseTimeout);
+    aSelf->iTransactionClient->SubmitL(aRawHeaders, aPostBuf, aResponseTimeout, aPartialDataFlag);
 }
 
 jobjectArray NativeHttpTransaction::GetResponseL(JNIEnv* aJni)
@@ -273,6 +273,17 @@
     LOG(ESOCKET,EInfo,"-NativeHttpTransaction::DataReadyForRead");
 }
 
+void NativeHttpTransaction::DoPostCallBack()
+{
+    LOG(ESOCKET,EInfo,"+NativeHttpTransaction::DoPostCallBack");
+
+    NativeHttpSession* session = reinterpret_cast<NativeHttpSession*>(iFuncServer);
+    session->doDataConsumedCallback(iJniPeer);
+
+    LOG(ESOCKET,EInfo,"-NativeHttpTransaction::DoPostCallBack");
+
+}
+
 void NativeHttpTransaction::ExecuteCloseTransaction(int aSelfhandle)
 {
     NativeHttpTransaction *aSelf = reinterpret_cast<NativeHttpTransaction*>(aSelfhandle);
@@ -309,6 +320,35 @@
     return handle;
 }
 
+int NativeHttpTransaction::PostDataL(JNIEnv* aJni,const jbyteArray aPostData, const jint aPostDataLength, const jboolean iEndOfRequest)
+{
+
+    HBufC8* postBuf=NULL;
+    TInt ret = 0;
+    if (aPostDataLength>KErrNone)
+    {
+        postBuf=HBufC8::NewLC(aPostDataLength);
+        TPtr8 bufPtr = postBuf->Des();
+        User::LeaveIfError(S60CommonUtils::CopyToNative(*aJni , aPostData , 0 , aPostDataLength , bufPtr));
+        CleanupStack::Pop(postBuf);
+    }
+    int handle = reinterpret_cast<int>(this);
+    int hbufhandle = reinterpret_cast<int>(postBuf);
+    CallMethodL(ret, this,&NativeHttpTransaction::ExecutePostDataL,handle, hbufhandle, iEndOfRequest, iFuncServer);
+    return KErrNone;
+}
+
+TInt NativeHttpTransaction::ExecutePostDataL(int aSelfhandle, int aPostBufhandle, bool iEndOfRequest)
+{
+
+    NativeHttpTransaction *aSelf = reinterpret_cast<NativeHttpTransaction*>(aSelfhandle);
+    HBufC8* aPostBuf = reinterpret_cast<HBufC8*>(aPostBufhandle);
+    aSelf->iTransactionClient->PostDataL(aPostBuf , iEndOfRequest);
+
+
+    return KErrNone;
+}
+
 /*
 * Returns the amount of bytes avaible for read in our buffer.
 */