当前位置: 首页>>代码示例>>C++>>正文


C++ HttpResponse::GetStatusText方法代码示例

本文整理汇总了C++中HttpResponse::GetStatusText方法的典型用法代码示例。如果您正苦于以下问题:C++ HttpResponse::GetStatusText方法的具体用法?C++ HttpResponse::GetStatusText怎么用?C++ HttpResponse::GetStatusText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HttpResponse的用法示例。


在下文中一共展示了HttpResponse::GetStatusText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnTransactionCompleted

void HttpThread::OnTransactionCompleted(HttpSession & /*httpSession*/,
                                          HttpTransaction & httpTransaction)
{
  HttpResponse * pResponse = httpTransaction.GetResponse();
  if (pResponse->GetHttpStatusCode() == HTTP_STATUS_OK
      || pResponse->GetHttpStatusCode() == HTTP_STATUS_PARTIAL_CONTENT)
  {
    m_callback.OnFinish(200, m_begRange, m_endRange);
  }
  else
  {
    LOG(LWARNING, ("Download has finished with status code:", pResponse->GetHttpStatusCode(),
                   " and text:", FromTizenString(pResponse->GetStatusText() )));
    m_callback.OnFinish(-100, m_begRange, m_endRange);
  }
}
开发者ID:DINKIN,项目名称:omim,代码行数:16,代码来源:http_thread_tizen.cpp

示例2: OnHttpDownloadInProgress

void HttpThread::OnHttpDownloadInProgress(HttpSession & /*httpSession*/,
                                          Tizen::Net::Http::HttpTransaction & httpTransaction,
                                          int64_t currentLength,
                                          int64_t totalLength)
{
  HttpResponse * pResponse = httpTransaction.GetResponse();
  if (pResponse->GetHttpStatusCode() == HTTP_STATUS_OK || pResponse->GetHttpStatusCode() == HTTP_STATUS_PARTIAL_CONTENT)
  {
    ByteBuffer * pBuffer = 0;
    pBuffer = pResponse->ReadBodyN();
    int const chunkSize = pBuffer->GetLimit();
    m_downloadedBytes += chunkSize;
    m_callback.OnWrite(m_begRange + m_downloadedBytes - chunkSize, pBuffer->GetPointer(), chunkSize);
    delete pBuffer;
  }
  else
    LOG(LERROR, ("OnHttpDownloadInProgress ERROR", FromTizenString(pResponse->GetStatusText())));
}
开发者ID:DINKIN,项目名称:omim,代码行数:18,代码来源:http_thread_tizen.cpp

示例3: if

void
ProjectGiraffeTab1::OnTransactionReadyToRead (HttpSession &httpSession, HttpTransaction &httpTransaction, int availableBodyLen)
{
	HttpResponse* pHttpResponse = httpTransaction.GetResponse();
	HttpHeader* pHttpHeader = null;
	AppLog("Checking HTTP Status Code");
	if (pHttpResponse->GetHttpStatusCode() == HTTP_STATUS_OK)
	{
		//		MessageBox msgBox;
		//		msgBox.Construct(L"HTTP STATUS", L"HTTP Request OK", MSGBOX_STYLE_NONE, 3000);
		//		int modalresult = 0;
		//		msgBox.ShowAndWait(modalresult);

		ByteBuffer* pBody = null;
		String statusText = pHttpResponse->GetStatusText();
		String version = pHttpResponse->GetVersion();

		pHttpHeader = pHttpResponse->GetHeader();
		pBody = pHttpResponse->ReadBodyN();
		//delete pBody;

		//Parses from ByteBuffer
		IJsonValue* pValue = JsonParser::ParseN(*pBody);

		AppLog("Received HTTP response.");

		AppLog("Before traverse %d", _tableView->GetItemCount());
		_pJsonKeyList->RemoveAll(true);
		_pValueList->RemoveAll(true);
		_items->RemoveAll(true);
		// Populate the panel
		TraverseFunction(pValue);

		AppLog("After traverse");

		//clean up allocated jsonValues
		if (pValue->GetType() == JSON_TYPE_OBJECT)
		{
			// Converts the pValue to JsonObject
			JsonObject* pObject = static_cast< JsonObject* >(pValue);
			pObject->RemoveAll(true);
		}
		else if (pValue->GetType() == JSON_TYPE_ARRAY)
		{
			// Converts the pValue to JsonArray
			JsonArray* pArray = static_cast< JsonArray* >(pValue);
			pArray->RemoveAll(true);
		}

		delete pBody;
		delete pValue;
		_tableView->ScrollToItem(0);



	}else{
		AppLog("HTTP Status not OK");
	}
	//Remove load icon here.
	//_loadingPopupThread->Quit();
	//_loadingPopupThread->Join();
}
开发者ID:justinkchen,项目名称:giraffe,代码行数:62,代码来源:ProjectGiraffeTab1.cpp


注:本文中的HttpResponse::GetStatusText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。