47 */ |
47 */ |
48 |
48 |
49 TInt NativeHttpSession::NewL(JNIEnv& aJni, jobject aPeer,/* TJavaEventServer aServer,*/ TInt aType, TInt aAPNId, TInt * aErr, TInt * apnerr) |
49 TInt NativeHttpSession::NewL(JNIEnv& aJni, jobject aPeer,/* TJavaEventServer aServer,*/ TInt aType, TInt aAPNId, TInt * aErr, TInt * apnerr) |
50 { |
50 { |
51 NativeHttpSession* self = new(ELeave) NativeHttpSession(); |
51 NativeHttpSession* self = new(ELeave) NativeHttpSession(); |
52 |
52 |
53 *aErr = self->ConstructL(aJni, aPeer /* aServer*/, aType, aAPNId, apnerr); |
53 *aErr = self->ConstructL(aJni, aPeer /* aServer*/, aType, aAPNId, apnerr); |
54 LOG1(ESOCKET,EInfo,"NativeHttpSession::NewL - aErr : %d",*aErr); |
54 LOG1(ESOCKET,EInfo,"NativeHttpSession::NewL - aErr : %d",*aErr); |
55 |
55 |
56 self->attachToVm(aJni,aPeer); |
56 self->attachToVm(aJni,aPeer); |
57 // Pop the cleanup of the object and create a handle: |
57 // Pop the cleanup of the object and create a handle: |
58 return reinterpret_cast<TInt>(self); //selfCleanup.GetHandle(); |
58 return reinterpret_cast<TInt>(self); //selfCleanup.GetHandle(); |
59 } |
59 } |
60 |
60 |
117 return err; |
117 return err; |
118 } |
118 } |
119 |
119 |
120 void NativeHttpSession::doSubmitCallback(TInt aStatus,jobject &aPeer) |
120 void NativeHttpSession::doSubmitCallback(TInt aStatus,jobject &aPeer) |
121 { |
121 { |
122 LOG(ESOCKET,EInfo,"+doSubmitCallback1"); |
122 LOG(ESOCKET,EInfo,"+doSubmitCallback1"); |
123 jobject localPeerObject = mJniEnv->NewLocalRef(aPeer); |
123 jobject localPeerObject = mJniEnv->NewLocalRef(aPeer); |
124 if(localPeerObject) |
124 if (localPeerObject) |
125 { |
125 { |
126 // java side peer object may be GC'ed when this call is being made. |
126 // java side peer object may be GC'ed when this call is being made. |
127 mJniEnv->CallVoidMethod(aPeer,iSubmitCallbackMethodID,aStatus); |
127 mJniEnv->CallVoidMethod(aPeer,iSubmitCallbackMethodID,aStatus); |
128 } |
128 } |
129 else |
129 else |
130 { |
130 { |
131 ELOG(ESOCKET,"NativeHttpSession::doSubmitCallback: Error!! java peer object not found "); |
131 ELOG(ESOCKET,"NativeHttpSession::doSubmitCallback: Error!! java peer object not found "); |
132 } |
132 } |
133 LOG(ESOCKET,EInfo,"-doSubmitCallback1"); |
133 LOG(ESOCKET,EInfo,"-doSubmitCallback1"); |
134 } |
134 } |
135 |
135 |
136 void NativeHttpSession::doReadCallback(TInt aStatus,jobject &aPeer) |
136 void NativeHttpSession::doReadCallback(TInt aStatus,jobject &aPeer) |
137 { |
137 { |
138 LOG(ESOCKET,EInfo,"+doReadCallback1"); |
138 LOG(ESOCKET,EInfo,"+doReadCallback1"); |
139 jobject localPeerObject = mJniEnv->NewLocalRef(aPeer); |
139 jobject localPeerObject = mJniEnv->NewLocalRef(aPeer); |
140 if(localPeerObject) |
140 if (localPeerObject) |
141 { |
141 { |
142 mJniEnv->CallVoidMethod(aPeer,iReadCallbackMethodID,aStatus); |
142 mJniEnv->CallVoidMethod(aPeer,iReadCallbackMethodID,aStatus); |
143 } |
143 } |
144 else |
144 else |
145 { |
145 { |
146 ELOG(ESOCKET,"NativeHttpSession::doReadCallback: Error!! java peer object not found "); |
146 ELOG(ESOCKET,"NativeHttpSession::doReadCallback: Error!! java peer object not found "); |
147 } |
147 } |
148 LOG(ESOCKET,EInfo,"-doReadCallback1"); |
148 LOG(ESOCKET,EInfo,"-doReadCallback1"); |
149 } |
149 } |
150 |
150 |