void GPageLoadRequestManager::ReceiveRequest(GUpdateURLCurrentPageRequest* pReq)
{
	LOG_LEVEL4("ReceiveRequest(GUpdateURLCurrentPageRequest)");

	QMutexLocker oLocker(&m_qmInternalMutex);

	if( !m_qmSessions.contains(pReq->GetSessionId()) )
	{
		LOG_LEVEL1("Invalid session id. Discarding request.");
		delete pReq;
		return;
	}

	pReq->SetRequestId(GenerateRequestId());
	pReq->SetNotification(false);

	if( m_qlsReqs.isEmpty() )
	{
		ProcessRequest(pReq);
	}
	else
	{
		m_qlsReqs << pReq;

		LOG_LEVEL4(QString("Quantity of pending requests(") + QString::number(m_qlsReqs.count()) + ").");
	}
}
RestHttpClient::Result RestHttpClient::DoHttpRequest(
  const HttpRequestParameters& parameters)
{
  shared_ptr<IHttpClient> pHttpClient = IHttpClient::Create();

  // generate a request id (i.e., a new ScenarioId and a new CorrelationId)
  string requestId = GenerateRequestId();

  // Add headers
  pHttpClient->AddAcceptMediaTypeHeader("application/json");
  pHttpClient->AddHeader("content-type", "application/json");
  pHttpClient->AddAcceptLanguageHeader(ConstructLanguageHeader());
  pHttpClient->AddAuthorizationHeader(ConstructAuthTokenHeader(parameters.
                                                               accessToken));
  pHttpClient->AddHeader("x-ms-rms-request-id", requestId);

  // x-ms-rms-platform-id header consists of AppName, AppVersion, SDKVersion,
  // AppPublisherId, AppPublisherName, UniqueClientID
  if (platformIdHeaderCache.size() == 0)
  {
    platformIdHeaderCache = GetPlatformIdHeader();
  }

  pHttpClient->AddHeader("x-ms-rms-platform-id", platformIdHeaderCache);

  Result result;

  switch (parameters.type)
  {
  case HTTP_POST:

    Logger::Hidden(
      "RestHttpClient::DoHttpRequest doing http POST to %s, Request-ID: %s",
      parameters.requestUrl.c_str(),
      requestId.c_str());

    result.status = pHttpClient->Post(
      parameters.requestUrl,
      parameters.requestBody, std::string("application/json"),
      result.responseBody);

    break;

  case HTTP_GET:

    Logger::Hidden(
      "RestHttpClient::DoHttpRequest doing http GET to %s, Request-ID: %s",
      parameters.requestUrl.c_str(),
      requestId.c_str());

    result.status = pHttpClient->Get(
      parameters.requestUrl, result.responseBody);

    break;
  }

  Logger::Hidden("RestHttpClient::DoHttpRequest returned status code: %d",
                 (int)result.status);

  return result;
}