WEB开发网
开发学院手机开发Symbian 开发 Symbian (Http DownLoad) Http 引擎下载实现 阅读

Symbian (Http DownLoad) Http 引擎下载实现

 2010-02-08 03:06:00 来源:WEB开发网   
核心提示:// Submit the transaction. After this the framework will give transaction// events via MHFRunL and MHFRunError.iTransaction.SubmitL();iRunning = ETrue;}//请求完成后,

// Submit the transaction. After this the framework will give transaction

// events via MHFRunL and MHFRunError.

iTransaction.SubmitL();

iRunning = ETrue;

}

//请求完成后,事物的相关事件都会回调

void CWebClientEngine::MHFRunL(RHTTPTransaction aTransaction,

const THTTPEvent& aEvent)

{

switch (aEvent.iStatus)

{

//响应消息头

case THTTPEvent::EGotResponseHeaders:

{

RHTTPResponse resp = aTransaction.Response();

TInt status = resp.StatusCode();

if (status == 200 || status == 206)

{

//成功连接的情况下,解析头.

DumpRespHeadersL(aTransaction);

iObserver->HandleWebDataStart();

}

else if (status >= 300 && status <= 399)

{

iRunning = EFalse;

//发生跳转时,得到跳转地址

GetLocationL(aTransaction);

iDownloadSize = 0;

//得到跳转地址后,重新请求

StartGetClient(m_Location,iDownloadSize);

break;

}

else

{

//发生异常,关闭事物

iTransaction.Close();

iRunning = EFalse;

break;

}

}

break;

case THTTPEvent::EGotResponseBodyData:

{

//响应消息体

// Get the body data supplier

MHTTPDataSupplier* body = aTransaction.Response().Body();

TPtrC8 dataChunk;

TBool isLast = body->GetNextDataPart(dataChunk);

RLog::LogPoor(_L("isLast = "),isLast);

DataLength = dataChunk.Length();

bIsReciveData = ETrue;

if(bIAPIsWap)//如果是WAP接入点.我们需要判断移动拦截页面

{

//如果是移动拦截页,再次请求

TBool err = CheckRecv(dataChunk);

RLog::LogPoor(_L("err = "),err);

上一页  1 2 3 4 5  下一页

Tags:Symbian Http DownLoad

编辑录入:coldstar [复制链接] [打 印]
赞助商链接