• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TUriParser8类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中TUriParser8的典型用法代码示例。如果您正苦于以下问题:C++ TUriParser8类的具体用法?C++ TUriParser8怎么用?C++ TUriParser8使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: __ASSERT_ALWAYS

RHTTPTransaction CTestCase10::GetTransactionL(TInt aIndex, RHTTPSession aSession, MHTTPTransactionCallback& aClient)
	{
	__ASSERT_ALWAYS(aIndex<KTransactionCount, User::Invariant());
	
	TPtrC8 uriDes;
	
	switch(aIndex)
		{
		case 0:
			{
			uriDes.Set(_L8("http://10.29.23.12"));
			} break;
		case 1:
			{
			uriDes.Set(_L8("http://10.29.23.12/manual/index.html"));
			} break;
		case 2:
			{
			uriDes.Set(_L8("http://10.29.23.12/manual/new_features_1_3.html"));
			} break;
		case 3:
			{
			uriDes.Set(_L8("http://10.29.23.12/wap/suite-08Jun2000/"));
			} break;
		case 4:
			{
			uriDes.Set(_L8("http://10.29.23.12/wap/suite-20Jun2000/"));
			} break;
		case 5:
			{
			uriDes.Set(_L8("http://10.29.23.12/manual/upgrading_to_1_3.html"));
			} break;
		case 6:
			{
			uriDes.Set(_L8("http://10.29.23.12/manual/install.html"));
			} break;
		case 7:
			{
			uriDes.Set(_L8("http://10.29.23.12/manual/invoking.html"));
			} break;
		case 8:
			{
			uriDes.Set(_L8("http://10.29.23.12/stats.html"));
			} break;
		case 9:
			{
			uriDes.Set(_L8("http://10.29.23.12/manual/stopping.html"));
			} break;
		case 10:
			{
			uriDes.Set(_L8("http://10.29.23.12/manual/mod/directives.html"));
			} break;
		case 11:
			{
			uriDes.Set(_L8("http://10.29.23.12/manual/images/custom_errordocs.gif"));
			} break;
		case 12:
			{
			uriDes.Set(_L8("http://10.29.23.12/manual/images/home.gif"));
			} break;
		case 13:
			{
			uriDes.Set(_L8("http://10.29.23.12/manual/images/index.gif"));
			} break;
		default:
			// Shouldn't happen!
			User::Invariant();
			break;
		}
	
	
	RStringF method = aSession.StringPool().StringF(HTTP::EGET,RHTTPSession::GetTable());
	TUriParser8 uri; 
	uri.Parse(uriDes);
	return aSession.OpenTransactionL(uri, aClient, method);
	}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:76,代码来源:CTestCase10.cpp


示例2: switch

void CTestTransaction::ConstructL(RHTTPSession& aSession)
	{
	TBool hasRequestBody = EFalse;

	switch (iTransactionType)
		{
		case HTTP::EPOST : 
		case HTTP::EPUT : 

			if (iFilename.Length() > 0)
				{
				User::LeaveIfError(SetFileNameL(iFilename));
				
				hasRequestBody = ETrue;
				}
		break ;
		
		case HTTP::EGET :
		case HTTP::EDELETE:
		case HTTP::EHEAD:
		case HTTP::ECONNECT :
		default:
		;
		}
	
	TUriParser8 KURI;
	KURI.Parse(iUri);		

	RStringPool strPool = aSession.StringPool();
	
	//	open a transaction within the required session and use the class callback object for 
	//	managing the subsequent events...

	iTransaction = aSession.OpenTransactionL(KURI, *this, strPool.StringF(iTransactionType, RHTTPSession::GetTable()));

	iState = EActive;
	
	RHTTPRequest request = iTransaction.Request();

	RHTTPHeaders headers = request.GetHeaderCollection();
	
	AddAcceptHeaderL(headers, strPool);

	SetUserAgentL(headers, strPool);

	SetContentLengthL(headers, strPool);

	AcceptEncodingL(headers, strPool);
	
	// Check to see if pipelining should be disabled

	if (Machine()->GetDefine(KITHDisablePipelining).CompareF(KITHYes)==0)
		{
		RHTTPTransactionPropertySet transactionPropertySet = iTransaction.PropertySet();
		RStringF name = strPool.StringF(HTTP::EHttpPipelining, RHTTPSession::GetTable());
		RStringF value = strPool.StringF(HTTP::EDisablePipelining,RHTTPSession::GetTable());
		transactionPropertySet.SetPropertyL(name,value);
		}
	
	

	//	Add request body
	if (hasRequestBody)
		{
		if (!AddRequestBodyL(headers, strPool))
			User::LeaveIfError(KErrArgument);
		}
	}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:68,代码来源:httptransaction.cpp


示例3: GetByUrlL

// ---------------------------------------------------------
// CUniObjectList::GetByUrlL
//
// GetByUrlL.
// ---------------------------------------------------------
//
EXPORT_C CUniObject* CUniObjectList::GetByUrlL( const TDesC& aUrl )
    {
    CUniObject* att = NULL;
    TBool found = EFalse;

    HBufC8* url8bit = HBufC8::NewLC( aUrl.Length() );

    CUri16* decodedUri = NULL;
    TUriParser8 parser;
	if( !url8bit )
        {
		return NULL;
		}

    if( aUrl.MatchF( KContentIdString ) == 0 )
        {
        //Remove "cid:" from the beginning
        url8bit->Des().Copy( aUrl.Right( aUrl.Length() - KContentIdString().Length() + 1 ) );
        parser.Parse( *url8bit );
        }
    else
        {
        url8bit->Des().Copy( aUrl );
        parser.Parse( *url8bit );
        }
    decodedUri = UriUtils::ConvertToDisplayFormL( parser );
    CleanupStack::PushL( decodedUri );

    TInt count = iObjectArray->Count();
    for ( TInt i = 0; i < count && !found ; ++i )
        {
        TPtrC contentLocation = iObjectArray->At( i )->MimeInfo()->ContentLocation();
        TPtrC8 contentIdPtr = iObjectArray->At( i )->MimeInfo()->ContentId();
        CUri16* contLocUri = NULL;
        CUri16* contIdUri = NULL;
        HBufC8* contentLoc = NULL;
        HBufC8* contentId = NULL;

        // Convert content location as well.
        if ( contentIdPtr.Length() )
            {
            //Copy string to 8-bit descriptor
            contentId = HBufC8::NewLC( contentIdPtr.Length() );

            if ( contentId->Find( KCidLeftAngle ) == 0 &&
                 contentId->Find( KCidRightAngle ) == contentId->Length() - 1 )
                {
                // When comparing against cid, remove "<" and ">"
                contentId->Des().Copy( contentIdPtr.Mid( 1, contentIdPtr.Length() - 2 ) );
                }
            else
                {
                contentId->Des().Copy( contentIdPtr );
                }

            parser.Parse( *contentId );
            contIdUri = UriUtils::ConvertToDisplayFormL( parser );
            CleanupStack::PushL( contIdUri );
            }
         if ( contentLocation.Length() )
            {
            //Copy string to 8-bit descriptor
            contentLoc = HBufC8::NewLC( contentLocation.Length() );
            contentLoc->Des().Copy( contentLocation );
            parser.Parse( *contentLoc );
            contLocUri = UriUtils::ConvertToDisplayFormL( parser );
            CleanupStack::PushL( contLocUri );
            }

        if (
            ( ( contentLocation.Length() ) && (decodedUri->Uri().UriDes().CompareF( contLocUri->Uri().UriDes() ) == 0 ) ) ||
            ( ( contentIdPtr.Length() ) && (decodedUri->Uri().UriDes().CompareF( contIdUri->Uri().UriDes() ) == 0 ) ) )
            {
            att = iObjectArray->At( i );
            }

        if ( contentLoc )
            {
            CleanupStack::PopAndDestroy( 2, contentLoc ); // contentLoc, contLocUri
            }
        if ( contentId )
            {
            CleanupStack::PopAndDestroy( 2, contentId ); // contentId, contIdUri
            }

        }
    CleanupStack::PopAndDestroy( 2, url8bit ); // decodedUri, url8bit
    return att;
    }
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:95,代码来源:UniObjectList.cpp


示例4: qDebug

//---------------------------------------------------------------
// CNativeMmsUtility::getByUrlL
// @see header
//---------------------------------------------------------------
const QString CNativeMmsUtility::getByUrlL(const TDesC& url)
{
#ifdef _DEBUG_TRACES_
    qDebug() << " Enter CNativeMmsUtility::getByUrlL";
#endif

    CMsvAttachment* targetattachment = NULL;
    TBool found = EFalse;

    //newlc puts it on cleanupstack
    HBufC8* url8bit = HBufC8::NewLC(url.Length());

    CUri16* decodedUri = NULL;
    TUriParser8 parser;

    //get the uri in display format
    if (url.MatchF(KContentIdString) == 0)
    {
        //Remove "cid:" from the beginning
        url8bit->Des().Copy(url.Right(url.Length()
                - KContentIdString().Length() + 1));
        parser.Parse(*url8bit);
    }
    else
    {
        url8bit->Des().Copy(url);
        parser.Parse(*url8bit);
    }
    decodedUri = UriUtils::ConvertToDisplayFormL(parser);
    CleanupStack::PushL(decodedUri);

    //run through the attachements to check for a match
    TUint count = iattachmanager->AttachmentCount();
    for (int i = 0; i < count && !found; i++)
    {
        CMsvAttachment *attachment = iattachmanager->GetAttachmentInfoL(i);
        CleanupStack::PushL(attachment);

        //restore mimeheaders from the attachment
        CMsvMimeHeaders* mimeheaders = CMsvMimeHeaders::NewL();
        CleanupStack::PushL(mimeheaders);
        mimeheaders->RestoreL(*attachment);

        //check for a match with content-loc and then content-id
        if (resolvedByContentLocL(mimeheaders->ContentLocation(), *decodedUri)
                || resolvedByContentIdL(mimeheaders->ContentId(), *decodedUri))
        {
            targetattachment = CMsvAttachment::NewL(*attachment);
            found = ETrue;
        }

        CleanupStack::PopAndDestroy(2, attachment); //mimeheaders, attachment
    }

    CleanupStack::PopAndDestroy(decodedUri);
    if (url8bit)
        CleanupStack::PopAndDestroy(url8bit);

    if (targetattachment)
    {
#ifdef _DEBUG_TRACES_
        qDebug() << " Exit CNativeMmsUtility::getByUrlL";
#endif

        return XQConversions::s60DescToQString(targetattachment->FilePath());
    }
    else
    {
#ifdef _DEBUG_TRACES_
        qDebug() << " Exit CNativeMmsUtility::getByUrlL";
#endif

        return QString();
    }
}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:79,代码来源:conversationsengineutility.cpp


示例5: LOGFN

// ----------------------------------------------------------------------------
// CWmDrmDlaDefaultHttpManager::SubmitL
// Handler for the states EOpen and EReconnect.
// ----------------------------------------------------------------------------
void CWmDrmDlaDefaultHttpManager::SubmitL()
    {
    LOGFN( "CWmDrmDlaDefaultHttpManager::SubmitL" );

    TConnectionInfo info;
    GetConnectionInfoL( info );
    iIapNumber = info.iIapId;

    // Close old session:
    iHttpSession.Close();    

    // Open session
    iHttpSession.OpenL();
    RStringPool pool = iHttpSession.StringPool();

    // Associate HTTP session with connection
    RHTTPConnectionInfo connInfo = iHttpSession.ConnectionInfo();

    // Specify socket server
    SET_HTTP_PROPERTY( connInfo, pool, HTTP::EHttpSocketServ,
        iSocketServer.Handle() );
    // Specify connectionn to use
    TInt connPtr = reinterpret_cast<TInt>(&iConnection);
    SET_HTTP_PROPERTY( connInfo, pool, HTTP::EHttpSocketConnection, connPtr );

    // Install HTTP authentication filter
    InstallAuthenticationL( iHttpSession );

    CHttpCookieFilter::InstallFilterL( iHttpSession );

    RHTTPFilterCollection filterColl = iHttpSession.FilterCollection();
    filterColl.RemoveFilter(
        iHttpSession.StringPool().StringF(
            HTTP::ERedirect, RHTTPSession::GetTable() ) );

    CHttpUAProfFilterInterface::InstallFilterL( iHttpSession );

    // Parse URI
    TUriParser8 srcAddress;
    User::LeaveIfError( srcAddress.Parse( *iSrcAddress ) );

    // Open HTTP transaction
    iHttpTransaction = iHttpSession.OpenTransactionL( srcAddress, *this,
        HTTP_STRING( (EGet == iOperation) ? HTTP::EGET : HTTP::EPOST ) );
    iTransactionOpen = ETrue;

    // Set the data supplier if a POST operation
    if ( EPost == iOperation )
        {
        iHttpTransaction.Request().SetBody( *iDataSupplier );
        }


    TInt pos = iSrcAddress->Locate( '?' );

    // If no query ('?') pos is rightmost character
    pos = (pos != KErrNotFound) ? pos : iSrcAddress->Length();
    TPtrC8 ptrUrl = iSrcAddress->Left( pos );

    // Only print if there is a ('?') and something to print after it
    if ( pos < iSrcAddress->Length() )
      {
      TPtrC8 ptrQs = iSrcAddress->Mid( pos );
      }
    // Set HTTP headers for the transaction
    RHTTPHeaders hdr = iHttpTransaction.Request().GetHeaderCollection();
    TInt nofheaders = iHdrValues.Count();

    for ( TInt i = 0; i < nofheaders; i++ )
        {
        TInt field = iHdrFields[i];
        const TDesC8& fieldStr = HTTP_STRING( field ).DesC();
        HBufC8* pValue = iHdrValues[i];
        SetHeaderL( hdr, field, *pValue );
        }

    // Submit HTTP transaction
    // This will set in motion the HTTP download
    iHttpTransaction.SubmitL();
    iState = ESubmit;
    }
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:85,代码来源:wmdrmdladefaulthttpmanager.cpp


示例6: _LIT8

void CHttpTestCase4::DoRunL()
	{
	// Literals used in the function
	_LIT8(KWapTestUrl,		"http://WapTestIP/perl/dumpform.pl");

	// Replace the host name in the URL
	HBufC8* newUrl8 = TSrvAddrVal::ReplaceHostNameL(KWapTestUrl(), iIniSettingsFile);
	CleanupStack::PushL(newUrl8);
	TPtr8 newUrlPtr8 = newUrl8->Des();

	TUriParser8 testURI;
	testURI.Parse(newUrlPtr8);

	//open a Session
	RHTTPSession mySession;
	mySession.OpenL();
	CleanupClosePushL(mySession);
	iEngine->Utils().LogIt(_L("Session Created(TC4)"));
	iEngine->Utils().LogIt(_L("Session parameters: Default"));
	
	//Get the mySession'string pool handle;
	iMyStrP = mySession.StringPool();

	//get strings this testcase needs
	RStringF textPlain = iMyStrP.StringF(HTTP::ETextPlain, RHTTPSession::GetTable());
	RStringF textHtml = iMyStrP.StringF(HTTP::ETextHtml, RHTTPSession::GetTable());
	RStringF mimeType = iMyStrP.StringF(HTTP::EApplicationXWwwFormUrlEncoded, RHTTPSession::GetTable());

	//Open a Transaction in mySession 
	RHTTPTransaction myTransaction;
	myTransaction = mySession.OpenTransactionL(testURI, *this, iMyStrP.StringF(HTTP::EPOST,RHTTPSession::GetTable()));
	CleanupClosePushL(myTransaction);
	iEngine->Utils().LogIt(_L("Transaction Created in mySession"));

	//Get a handle of the request in myTransaction
	RHTTPRequest myRequest = myTransaction.Request();
	RHTTPHeaders myHeaders = myRequest.GetHeaderCollection();

	//provide  some headers 
	THTTPHdrVal v2(textPlain);
	THTTPHdrVal v3(textHtml);
	THTTPHdrVal v4(6);
	THTTPHdrVal v5(mimeType);

	myHeaders.SetFieldL(iMyStrP.StringF(HTTP::EAccept,RHTTPSession::GetTable()),v2);
	myHeaders.SetFieldL(iMyStrP.StringF(HTTP::EAccept,RHTTPSession::GetTable()),v3);
	myHeaders.SetFieldL(iMyStrP.StringF(HTTP::EContentLength,RHTTPSession::GetTable()),v4);
	myHeaders.SetFieldL(iMyStrP.StringF(HTTP::EContentType,RHTTPSession::GetTable()), v5);

	TSrvAddrVal::LogUsing8BitDesL(iEngine, newUrlPtr8);
	iEngine->Utils().LogIt(_L("Method:Post"));
	iEngine->Utils().LogIt(_L("Accept:test/plain,text/html"));
	iEngine->Utils().LogIt(_L("Content-Type: application/x-www-form-urlencoded"));
	iEngine->Utils().LogIt(_L("Content-Length: 6"));
		
	myRequest.SetBody(*this);
	myTransaction.SubmitL();
	CActiveScheduler::Start();
	
	//close Transaction and session
	myTransaction.Close();
	iEngine->Utils().LogIt(_L("Transaction terminated\n"));
	mySession.Close();
	iEngine->Utils().LogIt(_L("Session terminated"));
	if (iTestFail==1)
		{
		User::Leave(-1);
		}
	CleanupStack::Pop(2); // mySession, myTansaction
	CleanupStack::PopAndDestroy(newUrl8);
	}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:71,代码来源:Tc4.cpp


示例7: switch

//Invoke http method
void CHttpClient::InvokeHttpMethodL(TInt aCommand)
{
    RStringF method;
    iHasARequestBody = EFalse;

    if ( iConnectionManager && !iConnectionManager->IsOfflineMode())
    {
        iConnectionManager->SetupConnection();

        RStringPool strP = iConnectionManager->GetHTTPSession().StringPool();

        switch (aCommand)
        {
        case CHttpConstants::EGet:
            method = strP.StringF(HTTP::EGET,RHTTPSession::GetTable());
            break;
        case CHttpConstants::EPost:
            method = strP.StringF(HTTP::EPOST,RHTTPSession::GetTable());
            iHasARequestBody = ETrue;
            break;
        default:
            return;//other commands not supported
        }

        //read body and url
        GetRequestBodyL();

        TInt realSize = 0;
        for ( TInt i = 0; i < CHttpConstants::KMaxUrlSize && iUriPtr[i]; i++)
        {
            realSize++;
        }

        TBuf8<CHttpConstants::KMaxUrlSize> tmp;
        tmp.Copy(iUriPtr.Ptr(), realSize);
        tmp.ZeroTerminate();

        TUriParser8 uri;
        uri.Parse(tmp);

        iTrans = iConnectionManager->GetHTTPSession().OpenTransactionL(uri, *iTransObs, method);
        RHTTPHeaders hdr = iTrans.Request().GetHeaderCollection();

        // Add headers appropriate to all methods
        SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent);
        SetHeaderL(hdr, HTTP::EAccept, KAccept);

        // Add headers and body data for methods that use request bodies
        if (iHasARequestBody)
        {
            // Content type header
            TBuf8<CHttpConstants::KMaxContentTypeSize> contTypeBuf;
            contTypeBuf.Copy(_L("text/html"));
            RStringF contTypeStr = iConnectionManager->GetHTTPSession().StringPool().OpenFStringL(contTypeBuf);
            THTTPHdrVal contType(contTypeStr);
            hdr.SetFieldL(iConnectionManager->GetHTTPSession().StringPool().StringF(HTTP::EContentType,RHTTPSession::GetTable()), contType);
            contTypeStr.Close();

            MHTTPDataSupplier* dataSupplier = this;
            iTrans.Request().SetBody(*dataSupplier);
        }

        // submit the transaction
        iTrans.SubmitL();

        // Start the scheduler, once the transaction completes or is cancelled on an error the scheduler will be
        // stopped in the event handler
        CActiveScheduler::Start();

        //close and delete request file
        iReqBodyFile.Close();
        iFileServ.Delete(iReqBodyFilePath);
    }
}
开发者ID:jayliu,项目名称:rhodes,代码行数:75,代码来源:HttpClient.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TVar类代码示例发布时间:2022-05-31
下一篇:
C++ TUNER_MODULE类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap