Namespaces
Variants
Actions

Archived:Using the HTTP Client API with RConnection

Jump to: navigation, search
Archived.png
Archived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

Article Metadata

Tested with
Devices(s): All

Compatibility
Platform(s): S60 5th Edition
S60 3rd Edition and Feature Packs
S60 2nd Edition and Feature Packs
Series 80 2nd Edition

Article
Keywords: RHTTPSession, RConnection, RHTTPConnectionInfo, EHttpSocketConnection, EHttpSocketServ, RStringPool, RHTTPHeaders
Created: User:Technical writer 1 (07 Apr 2005)
Last edited: hamishwillee (14 Jun 2012)

Overview

Using the HTTP Client API with RConnection

Description

If you use the HTTP Client API, there are no chances to specify connection preferences. The default preference is to show the IAP selection dialog. However, it is more user-friendly that the IAP is selected only once by the user. The solution is to create a connection using RConnection, where you can define connection preferences as you like. Then you can attach a HTTP session to the connection as shown before.
---

User::LeaveIfError(iSocketServ.Connect());
User::LeaveIfError(iConnection.Open(iSocketServ));
iHttpSession.OpenL();
 
// Initiate connection
iConnection.Start(iStatus);
 
//...
 
RHTTPConnectionInfo connInfo = iHttpSession.ConnectionInfo();
RStringPool pool = iHttpSession.StringPool();
 
// Attach to socket server
connInfo.SetPropertyL(pool.StringF(HTTP::EHttpSocketServ, RHTTPSession::GetTable()), THTTPHdrVal(iSocketServ.Handle()));
 
// Attach to connection
TInt connPtr = REINTERPRET_CAST(TInt, &iConnection);
connInfo.SetPropertyL(pool.StringF(HTTP::EHttpSocketConnection, RHTTPSession::GetTable()), THTTPHdrVal(connPtr));
 
// Open transaction...
iHttpTrans = iHttpSession.OpenTransactionL(iUri, *this, pool.StringF(HTTP::EGET, RHTTPSession::GetTable()));
RHTTPHeaders hdr = iHttpTrans.Request().GetHeaderCollection();
 
//...
This page was last modified on 14 June 2012, at 08:49.
105 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved