javacommons/gcfprotocols/http/src.s60/chttpsessionclient.cpp
branchRCL_3
changeset 23 e5618cc85d74
parent 14 04becd199f91
child 25 ae942d28ec0e
equal deleted inserted replaced
21:4376525cdefb 23:e5618cc85d74
    20 #include "javavalidationfilter.h"
    20 #include "javavalidationfilter.h"
    21 #include <http/thttpfilteriterator.h>
    21 #include <http/thttpfilteriterator.h>
    22 #include <httpstringconstants.h>
    22 #include <httpstringconstants.h>
    23 #include <e32svr.h>
    23 #include <e32svr.h>
    24 #include "logger.h"
    24 #include "logger.h"
       
    25 
       
    26 #ifdef RD_JAVA_S60_RELEASE_9_2_ONWARDS
       
    27 #include <extendedconnpref.h> // extended connection preference
       
    28 #include <connpref.h>
       
    29 #else
    25 #include <commdbconnpref.h>
    30 #include <commdbconnpref.h>
       
    31 #endif
    26 
    32 
    27 #include <http/cecomfilter.h>
    33 #include <http/cecomfilter.h>
    28 #include <httpfilterproxyinterface.h>
    34 #include <httpfilterproxyinterface.h>
    29 #include <httpfiltercommonstringsext.h>
    35 #include <httpfiltercommonstringsext.h>
    30 
    36 
   144             {
   150             {
   145                 LOG(ESOCKET,EInfo,"+HttpSessionClient::iConnection.Open failed ");
   151                 LOG(ESOCKET,EInfo,"+HttpSessionClient::iConnection.Open failed ");
   146                 *apnerr = ret;
   152                 *apnerr = ret;
   147                 return;
   153                 return;
   148             }
   154             }
   149 
   155 #ifdef RD_JAVA_S60_RELEASE_9_2_ONWARDS
       
   156             TConnPrefList prefList;
       
   157             TExtendedConnPref prefs;
       
   158             prefs.SetSnapId(aAPNId);
       
   159             prefList.AppendL(&prefs);
       
   160             ret = iConnection.Start(prefList);
       
   161 #else
   150             TCommSnapPref connPref;
   162             TCommSnapPref connPref;
   151             connPref.SetSnap(aAPNId);
   163             connPref.SetSnap(aAPNId);
   152             ret = iConnection.Start(connPref);
   164             ret = iConnection.Start(connPref);
       
   165 #endif
       
   166 
       
   167             LOG(ESOCKET,EInfo,"+HttpSessionClient:: using extended connection prefernce in snap case");
   153             LOG1(ESOCKET,EInfo,"iConnection.Start returned %d",ret);
   168             LOG1(ESOCKET,EInfo,"iConnection.Start returned %d",ret);
   154             if (ret < 0)
   169             if (ret < 0)
   155             {
   170             {
   156                 *apnerr = ret;
   171                 *apnerr = ret;
   157                 //   return;
   172                 //   return;
   170     } // end of if(aType == 3 )
   185     } // end of if(aType == 3 )
   171     else
   186     else
   172     {
   187     {
   173         if (aType == 3) // IAP Id
   188         if (aType == 3) // IAP Id
   174         {
   189         {
       
   190             LOG(ESOCKET,EInfo,"+HttpSessionClient:: in iap case");
   175             if (aAPNId != -1)
   191             if (aAPNId != -1)
   176             {
   192             {
   177                 // Creates connection with selected IAP ID
   193                 // Creates connection with selected IAP ID
   178                 int ret = iSocketServ.Connect();
   194                 int ret = iSocketServ.Connect();
   179                 if (ret < 0)
   195                 if (ret < 0)
   187                 {
   203                 {
   188                     LOG(ESOCKET,EInfo,"+HttpSessionClient::iConnection.Open failed ");
   204                     LOG(ESOCKET,EInfo,"+HttpSessionClient::iConnection.Open failed ");
   189                     *apnerr = ret;
   205                     *apnerr = ret;
   190                     return;
   206                     return;
   191                 }
   207                 }
       
   208 
       
   209 #ifdef RD_JAVA_S60_RELEASE_9_2_ONWARDS
       
   210                 // Create connection preferences
       
   211                 TConnPrefList prefList;
       
   212                 TExtendedConnPref prefs;
       
   213                 prefs.SetIapId(aAPNId);
       
   214                 prefList.AppendL(&prefs);
       
   215                 ret = iConnection.Start(prefList);
       
   216                 LOG(ESOCKET,EInfo,"+HttpSessionClient:: using extended connection prefernce in iap case");
       
   217 #else
   192                 TCommDbConnPref pref;
   218                 TCommDbConnPref pref;
   193                 pref.SetIapId(aAPNId);
   219                 pref.SetIapId(aAPNId);
   194                 pref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
   220                 pref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
   195                 ret = iConnection.Start(pref);
   221                 ret = iConnection.Start(pref);
       
   222 #endif
       
   223 
   196                 if (ret < 0)
   224                 if (ret < 0)
   197                 {
   225                 {
   198                     *apnerr = ret;
   226                     *apnerr = ret;
   199                     //return;
   227                     //return;
   200                 }
   228                 }
   201                 RHTTPConnectionInfo connInfo = iHttpSession.ConnectionInfo();
   229                 RHTTPConnectionInfo connInfo = iHttpSession.ConnectionInfo();
       
   230                 //connInfo.SetPropertyL(iHttpSession.StringPool().StringF(
       
   231                 //                          HttpFilterCommonStringsExt::EAccessPointID, HttpFilterCommonStringsExt::GetTable()), aAPNId);
   202                 connInfo.SetPropertyL(iHttpSession.StringPool().StringF(
   232                 connInfo.SetPropertyL(iHttpSession.StringPool().StringF(
   203                                           HttpFilterCommonStringsExt::EAccessPointID, HttpFilterCommonStringsExt::GetTable()), aAPNId);
   233                                           HTTP::EHttpSocketServ, RHTTPSession::GetTable()), THTTPHdrVal(iSocketServ.Handle()));
       
   234                 TInt connPtr = REINTERPRET_CAST(TInt, &iConnection);
       
   235                 connInfo.SetPropertyL(iHttpSession.StringPool().StringF(
       
   236                                           HTTP::EHttpSocketConnection, RHTTPSession::GetTable()), THTTPHdrVal(connPtr));
   204             } // end of if ( aAPNId != -1)
   237             } // end of if ( aAPNId != -1)
   205         } // end of if(aType == 4)
   238         } // end of if(aType == 4)
   206         else
   239         else
   207         {
   240         {
   208             // Creates connection with no selected Network Access.
   241             // Creates connection with no selected Network Access.
   209         }
   242         }
   210 
   243 
   211     } // end of else
   244     } // end of else
   212 
   245 
   213     LOG1(ESOCKET,EInfo,"apnerr = ",*apnerr);
   246     LOG1(ESOCKET,EInfo,"apnerr = %d",*apnerr);
   214 
   247 
   215     // This is special case when that IAP/SNAP is not found
   248     // This is special case when that IAP/SNAP is not found
   216     // Override the http stack's feaute of using device default
   249     // Override the http stack's feaute of using device default
   217     if (*apnerr < 0)
   250     if (*apnerr < 0)
   218     {
   251     {
   219         LOG(ESOCKET,EInfo,"ECommDbDialogPrefPrompt set for the http session");
   252         LOG(ESOCKET,EInfo,"ECommDbDialogPrefPrompt set for the http session");
   220         int ret = iSocketServ.Connect();
   253         int ret = iSocketServ.Connect();
   221         ret = iConnection.Open(iSocketServ);
   254         ret = iConnection.Open(iSocketServ);
       
   255 #ifdef RD_JAVA_S60_RELEASE_9_2_ONWARDS
       
   256         TConnPrefList prefList;
       
   257         TExtendedConnPref prefs;
       
   258         prefs.SetConnSelectionDialog(ETrue);
       
   259         prefList.AppendL(&prefs);
       
   260         ret = iConnection.Start(prefList);
       
   261         LOG(ESOCKET,EInfo,"+HttpSessionClient:: using extended connection prefernce - error case ");
       
   262 #else
   222         TCommDbConnPref pref;
   263         TCommDbConnPref pref;
   223         pref.SetDialogPreference(ECommDbDialogPrefPrompt);
   264         pref.SetDialogPreference(ECommDbDialogPrefPrompt);
   224         ret = iConnection.Start(pref);
   265         ret = iConnection.Start(pref);
       
   266         LOG(ESOCKET,EInfo,"+HttpSessionClient:: using commdb con pref - error case ");
       
   267 #endif
   225 
   268 
   226         RHTTPConnectionInfo connInfo = iHttpSession.ConnectionInfo();
   269         RHTTPConnectionInfo connInfo = iHttpSession.ConnectionInfo();
   227         connInfo.SetPropertyL(iHttpSession.StringPool().StringF(
   270         connInfo.SetPropertyL(iHttpSession.StringPool().StringF(
   228                                   HTTP::EHttpSocketServ, RHTTPSession::GetTable()), THTTPHdrVal(iSocketServ.Handle()));
   271                                   HTTP::EHttpSocketServ, RHTTPSession::GetTable()), THTTPHdrVal(iSocketServ.Handle()));
   229         TInt connPtr = REINTERPRET_CAST(TInt, &iConnection);
   272         TInt connPtr = REINTERPRET_CAST(TInt, &iConnection);
   294 {
   337 {
   295     LOG(ESOCKET,EInfo,"+HttpSessionClient::RestartConnection12 + ");
   338     LOG(ESOCKET,EInfo,"+HttpSessionClient::RestartConnection12 + ");
   296     iConnection.Close();
   339     iConnection.Close();
   297     TInt ret = iConnection.Open(iSocketServ);
   340     TInt ret = iConnection.Open(iSocketServ);
   298 
   341 
       
   342     //TCommSnapPref connPref;
       
   343 #ifdef RD_JAVA_S60_RELEASE_9_2_ONWARDS
       
   344     TConnPrefList prefList;
       
   345     TExtendedConnPref prefs;
       
   346 
       
   347     if (iApnId!=-1)
       
   348         prefs.SetSnapId(iApnId);
       
   349     TRAPD(err,prefList.AppendL(&prefs));
       
   350     if (err == KErrNone)
       
   351         ret = iConnection.Start(prefList);
       
   352     else
       
   353         ret = iConnection.Start();
       
   354 #else
   299     TCommSnapPref connPref;
   355     TCommSnapPref connPref;
   300     if (iApnId!=-1)
   356     if (iApnId!=-1)
   301         connPref.SetSnap(iApnId);
   357         connPref.SetSnap(iApnId);
   302     ret = iConnection.Start(connPref);
   358     ret = iConnection.Start(connPref);
       
   359 
       
   360 #endif
   303     LOG(ESOCKET,EInfo,"+HttpSessionClient::RestartConnection + ");
   361     LOG(ESOCKET,EInfo,"+HttpSessionClient::RestartConnection + ");
   304 
   362 
   305 }
   363 }