本文整理汇总了C++中TUriParser8::Parse方法的典型用法代码示例。如果您正苦于以下问题:C++ TUriParser8::Parse方法的具体用法?C++ TUriParser8::Parse怎么用?C++ TUriParser8::Parse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TUriParser8
的用法示例。
在下文中一共展示了TUriParser8::Parse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void CINC097492_3::CreateTransArrayL()
{
RStringPool strP = iSession.StringPool();
TUriParser8 up;
up.Parse(KHttpUrl1);
RHTTPTransaction trans1 = iSession.OpenTransactionL(up, *this, strP.StringF(HTTP::EGET,RHTTPSession::GetTable()));
CleanupClosePushL(trans1);
iTransArray.Append(trans1);
CleanupStack::Pop(&trans1);
up.Parse(KHttpUrl2);
RHTTPTransaction trans2 = iSession.OpenTransactionL(up, *this, strP.StringF(HTTP::EGET,RHTTPSession::GetTable()));
CleanupClosePushL(trans2);
iTransArray.Append(trans2);
CleanupStack::Pop(&trans2);
up.Parse(KHttpUrl3);
RHTTPTransaction trans3 = iSession.OpenTransactionL(up, *this, strP.StringF(HTTP::EGET,RHTTPSession::GetTable()));
CleanupClosePushL(trans3);
iTransArray.Append(trans3);
CleanupStack::Pop(&trans3);
for(TInt i=0; i<iTransArray.Count(); i++)
{
iTransArray[i].SubmitL();
iOpenTransCount++;
}
}
示例2: CreateTransactionL
/**
Create a new transaction. Generate the full uri from a partial uri.
Also, generates the file path where the contents to be saved. Adds the transaction
object into array.
@param aUri [in] URI to download.
@param aParseHtml [in] Parse the downloaded HTML content. Default value: EFalse. ETrue value to parse
the HTML content. Typically the value will be set to ETrue only for the main page.
*/
void CTestWebBrowser::CreateTransactionL ( const TDesC8& aUri, TBool aParseHtml /* = EFalse */ )
{
TUriParser8 baseUri;
baseUri.Parse ( iBaseUri->Des() );
TUriParser8 refUri;
refUri.Parse ( aUri );
// Resolve uri
CUri8* uriPtr = CUri8::ResolveL( baseUri, refUri );
CleanupStack::PushL ( uriPtr );
// Generate the file path from the full http uri.
HBufC* filePath = GenerateFilePathL ( uriPtr->Uri() );
CleanupStack::PushL ( filePath );
// Create a new HTTP transaction object.
CBrowserTransaction* newTrans = CBrowserTransaction::NewL ( iHttpSession, iTestUtils, this, *filePath, aParseHtml );
CleanupStack::PopAndDestroy ( filePath );
CleanupStack::PushL ( newTrans );
iTransArray.AppendL ( newTrans );
// Open and submit the transaction.
newTrans->CreateTransactionL ( uriPtr->Uri().UriDes() );
newTrans->StartTransactionL ();
CleanupStack::Pop ( newTrans );
CleanupStack::PopAndDestroy ( uriPtr );
return;
}
示例3: LocalHostCheckL
// -----------------------------------------------------------------------------
// LocalHostCheckL
// If the host is a local host, then remove the proxy property. Returns ETrue
// if the transaction request URI was for a localhost.
// -----------------------------------------------------------------------------
//
TBool LocalHostCheckL(RHTTPTransaction& aTransaction, RStringPool& aStringPool)
{
_LIT8(KLoopbackIPv4Url, "http://127.0.0.1");
RHTTPRequest request = aTransaction.Request();
TUriC8 uri = request.URI();
TUriParser8 parserLoopBack;
parserLoopBack.Parse(KLoopbackIPv4Url());
TInt match = parserLoopBack.Compare(uri, EUriHost);
if (KErrNone != match)
{
_LIT8(KLocalHostUrl, "http://localhost");
// try another compare - compare against the "localhost".
TUriParser8 parserLocalHost;
parserLocalHost.Parse(KLocalHostUrl());
match = parserLocalHost.Compare(uri, EUriHost);
if (KErrNone == match)
{
_LIT8(KLoopbackIPv4, "127.0.0.1");
// "localhost" resolves to "::1", manually, replace with "127.0.0.1"
CUri8* newUri = CUri8::NewLC(uri);
newUri->SetComponentL(KLoopbackIPv4(), EUriHost);
request.SetURIL(newUri->Uri());
CleanupStack::PopAndDestroy(newUri);
}
}
if (KErrNone == match)
{
// request is for localhost, explicitly state that this transaction
// must not be sent to proxy.
RStringF proxyUsageStrF = aStringPool.StringF(HTTP::EProxyUsage,
RHTTPSession::GetTable());
RStringF dontUseProxyStrF = aStringPool.StringF(HTTP::EDoNotUseProxy,
RHTTPSession::GetTable());
aTransaction.PropertySet().RemoveProperty(proxyUsageStrF);
aTransaction.PropertySet().SetPropertyL(proxyUsageStrF, dontUseProxyStrF);
//RStringF proxyAddrStrF = aStringPool.StringF(HTTP::EProxyAddress,
// RHTTPSession::GetTable());
//aTransaction.PropertySet().RemoveProperty(proxyAddrStrF);
return ETrue;
}
return EFalse;
}
示例4: FillProfileRegistrar
void CMCETestUIEngineOutRefer::FillProfileRegistrar()
{
// trying to get profile registrar
TUriParser8 parser;
const TDesC8& aor = iProfile->Aor();
parser.Parse( aor ) ;
CUri8* uri8 = CUri8::NewLC( parser );
const TDesC8& registrar = uri8->Uri().Extract( EUriHost ) ;
HBufC*registrar16 = HBufC16::NewLC( KRecipent().Length() + registrar.Length() );
TPtr registrarPtr = registrar16->Des();
registrarPtr.Copy( registrar );
iReferParams.iRecipentAddress.Append(KRecipent) ;
iReferParams.iRecipentAddress.Append(*registrar16) ;
iReferParams.iReferTo.Append(KRecipent) ;
iReferParams.iReferTo.Append(*registrar16) ;
CleanupStack::PopAndDestroy( registrar16 );
registrar16 = NULL;
CleanupStack::PopAndDestroy( uri8 );
uri8 = NULL;
// profile registrar end .....
}
示例5: SetupFullL
void UT_CMceEventReferMoEstablishedState::SetupFullL( )
{
iEventState = 0;
iReceived = 0;
iState = new( ELeave ) CMceEventReferMoEstablishedState();
SIPStrings::OpenL();
iSipProfile = CSIPProfile::NewL();
iConnection = CMceSipConnection::NewL( *iSipProfile );
iSIPEvent = CMceSipEvent::NewL( *iConnection, *this );
iSIPEvent->SetEventStateType( EMoRefer );
MCE_DELETE( iSIPEvent->iEvent );
iEvent = CMceComEvent::NewL( *iSIPEvent,
KDefaultExpires );
iSIPEvent->iEvent = iEvent;
iSIPEvent->SetCurrentState( KMceEstablishedEventStateIndex );
// create dialog
CSIPReferDialogAssoc* referDlg = CSIPReferDialogAssoc::NewL();
iSIPEvent->SetDialog( referDlg );
// Create server transaction
CSIPServerTransaction* serverTran = CSIPServerTransaction::NewL();
serverTran->SetType( 3 ); // NOTIFY
iSIPEvent->iRequest = serverTran;
// Create request elements
TUriParser8 uriParser;
User::LeaveIfError( uriParser.Parse( KRemoteUri() ) );
CUri8* remoteUri = CUri8::NewL(uriParser);
CleanupStack::PushL(remoteUri);
CSIPRequestElements* elem =CSIPRequestElements::NewL( remoteUri );
CleanupStack::Pop( remoteUri );
serverTran->SetRequestElements( elem );
iMsgElem = &elem->MessageElements();
}
示例6: ParseUriL
//Parse the URI
void CExampleInetProtUtil::ParseUriL()
{
//Create a Uri
_LIT(KText6, "\n\n\nParsing the Uri for....\n");
iConsole->Printf ( KText6 );
_LIT(KFullUriName,"K:\\ws\\direct\\direct.mmp");
TBuf<40> desFullUriName(KFullUriName);
iConsole->Printf ( desFullUriName );
//Convert from Unicode format to UTF-8 format
HBufC8* convert8 = EscapeUtils::ConvertFromUnicodeToUtf8L(desFullUriName);
TUriParser8 parser;
//Parse the Uri
TInt errResult = parser.Parse(*convert8);
if (errResult==KErrNone)
{
_LIT(KTextParsing, "\nThis Uri has been parsed successfully");
iConsole->Printf ( KTextParsing );
}
delete convert8;
iConsole->Getch();
}
示例7: acceptHdr
void CHttpTestCaseGet12::OpenTestSessionL()
{
iSession.OpenL();
iEngine->Utils().LogIt(_L("Session Created(Iteration 2 Get Test 12)"));
iEngine->Utils().LogIt(_L("Session parameters: Default"));
InstallAuthenticationL(iSession);
iMyStrP = iSession.StringPool();
// Literals used in the function
_LIT8(KUrlPath, "/http_tests/rc/401/private/index.html");
// Replace the host name in the URL
HBufC8* newUrl8 = TSrvAddrVal::ReplaceHostNameL(KWapTestIPSection(), iIniSettingsFile);
CleanupStack::PushL(newUrl8);
TPtr8 newUrlPtr8 = newUrl8->Des();
newUrlPtr8.Append(KUrlPath());
TUriParser8 testURI;
testURI.Parse(newUrlPtr8);
iTransaction = iSession.OpenTransactionL(testURI, *this, iMyStrP.StringF(HTTP::EGET,RHTTPSession::GetTable()));
iEngine->Utils().LogIt(_L("Transaction Created in Session"));
iOpenTransactionCount++;
//Get a handle of the request in iTransaction
RHTTPRequest myRequest = iTransaction.Request();
RHTTPHeaders myHeaders = myRequest.GetHeaderCollection();
//provide some headers
THTTPHdrVal acceptHdr(iMyStrP.StringF(HTTP::EAnyAny, RHTTPSession::GetTable()));
myHeaders.SetFieldL(iMyStrP.StringF(HTTP::EAccept, RHTTPSession::GetTable()),acceptHdr);
TSrvAddrVal::LogUsing8BitDesL(iEngine, newUrlPtr8);
iEngine->Utils().LogIt(_L("Method:GET"));
CleanupStack::PopAndDestroy(newUrl8);
}
示例8: ExecuteL
void CXmlHandler::ExecuteL()
{
__ASSERT_ALWAYS(iModel.iState == eStateComplete, User::Panic(KModuleName, EAlreadyRunning));
__ASSERT_ALWAYS(iModel.iQuery.iSearch != NULL, User::Panic(KModuleName, ENoQueryTerm));
iModel.iState = eStateStarting;
// next create a http transaction
TUriParser8 uri;
uri.Parse(KMpowerUrl);
// Set the transaction method to post as we will be submitting an xml soap request
RStringF method = iSession.StringPool().StringF(HTTP::EPOST, RHTTPSession::GetTable());
iTransaction.Close();
iTransaction = iSession.OpenTransactionL(uri, *this, method);
// Set headers for request; user agent, accepted content type and body's content type.
AddRequestHeaderL(HTTP::EUserAgent, KUserAgent);
AddRequestHeaderL(HTTP::EAccept, KAccept);
AddRequestHeaderL(HTTP::EContentType, KPlainText);
// set the body text handler
iTransaction.Request().SetBody(*this);
// and start it
iTransaction.SubmitL();
iModel.iState = eStateConnecting;
}
示例9: IdentifySchemeL
COCSPTransportDefault::TTransportScheme COCSPTransportDefault::IdentifySchemeL(const TDesC8& aURI)
{
TTransportScheme ret = ETransportSchemeNotSupported;
TUriParser8 uri;
TInt error = uri.Parse(aURI);
if (error != KErrNone || !uri.IsPresent(EUriScheme))
{
return ret;
}
const TPtrC8 scheme = uri.Extract(EUriScheme);
RStringPool stringPool;
stringPool.OpenL();
CleanupClosePushL(stringPool);
RStringF schemeF = stringPool.OpenFStringL(scheme);
CleanupClosePushL(schemeF);
RStringF httpF = stringPool.OpenFStringL(KHttpString);
CleanupClosePushL(httpF);
if (schemeF == httpF)
{
ret = ETransportSchemeHTTP;
}
CleanupStack::PopAndDestroy(3); // close httpF, schemeF, stringPool
return ret;
}
示例10: IssueHTTPGetL
// ----------------------------------------------------------------------------
// CClientEngine::IssueHTTPGetL()
//
// Start a new HTTP GET transaction.
// ----------------------------------------------------------------------------
void CClientEngine::IssueHTTPGetL(const TDesC8& aUri)
{
SetupConnectionL();
// Parse string to URI (as defined in RFC2396)
TUriParser8 uri;
uri.Parse(aUri);
// Get request method string for HTTP GET
RStringF method = iSession.StringPool().StringF(HTTP::EGET,
RHTTPSession::GetTable());
// Open transaction with previous method and parsed uri. This class will
// receive transaction events in MHFRunL and MHFRunError.
iTransaction = iSession.OpenTransactionL(uri, *this, method);
// Set headers for request; user agent and accepted content type
RHTTPHeaders hdr = iTransaction.Request().GetHeaderCollection();
SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent);
SetHeaderL(hdr, HTTP::EAccept, KAccept);
// Submit the transaction. After this the framework will give transaction
// events via MHFRunL and MHFRunError.
iTransaction.SubmitL();
iRunning = ETrue;
_LIT(KConnecting,"Connecting...");
iObserver.ClientEvent(KConnecting);
}
示例11: resolvedByContentIdL
//---------------------------------------------------------------
// CNativeMmsUtility::resolvedByContentIdL
// @see header
//---------------------------------------------------------------
TBool CNativeMmsUtility::resolvedByContentIdL(const TPtrC8& contentidptr,
const CUri16& targeturi)
{
#ifdef _DEBUG_TRACES_
qDebug() << " Enter CNativeMmsUtility::resolvedByContentIdL";
#endif
TBool result = EFalse;
TUriParser8 parser;
CUri16* contIdUri = NULL;
HBufC8* contentId = NULL;
//get content-id uri
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);
}
//compare content-id against the target uri
if ( (contentidptr.Length())
&& (targeturi.Uri().UriDes().CompareF(contIdUri->Uri().UriDes())
== 0))
{
#ifdef _DEBUG_TRACES_
qDebug() << " Exit CNativeMmsUtility::resolvedByContentIdL";
#endif
result = ETrue;
}
//do some cleanup
if (contentId)
{
CleanupStack::PopAndDestroy(2, contentId); // contentId, contIdUri
}
#ifdef _DEBUG_TRACES_
qDebug() << " Exit CNativeMmsUtility::resolvedByContentIdL";
#endif
return result;
}
示例12: ConstructL
void CTestMessageComposer::ConstructL()
{
iSession.OpenL();
iStringPool = iSession.StringPool();
iMessageComposer.OpenL(*this);
TUriParser8 up;
up.Parse(KUri);
iTransaction = iSession.OpenTransactionL(up, *this, iSession.StringPool().StringF(HTTP::EGET,RHTTPSession::GetTable()));
}
示例13: ConstructL
void CHttpClientTransactionImpl::ConstructL(CHttpService& aClient, const TDesC8& aMethod, const TDesC8& aUri)
{
TUriParser8 parser;
User::LeaveIfError(parser.Parse(aUri));
RHTTPSession sess = aClient.Session();
RStringF method = iStringPool.OpenFStringL(aMethod);
CleanupClosePushL(method);
iTransaction = sess.OpenTransactionL(parser, *this, method);
CleanupStack::PopAndDestroy(); // method
}
示例14:
RHTTPTransaction CINC052596::GetTransactionL(TInt aIndex, RHTTPSession aSession, MHTTPTransactionCallback& aClient)
{
__ASSERT_ALWAYS(aIndex<KTransactionCount, User::Invariant());
RStringF method = aSession.StringPool().StringF(HTTP::EGET,RHTTPSession::GetTable());
_LIT8(KTxtUri, "http://127.0.0.1");
TUriParser8 uri;
uri.Parse(KTxtUri());
return aSession.OpenTransactionL(uri, aClient, method);
}
示例15: scheme
// ----------------------------------------------------------------------------
// CURIContainer::CreateUri8L
// ----------------------------------------------------------------------------
//
CUri8* CURIContainer::CreateUri8L(const TDesC8& aValue)
{
TUriParser8 parser;
User::LeaveIfError(parser.Parse(aValue));
TPtrC8 scheme(parser.Extract(EUriScheme));
if (scheme.CompareF(SIPStrings::StringF(SipStrConsts::ESip).DesC()) == 0)
{
User::LeaveIfError(parser.Validate());
}
return CUri8::NewL(parser);
}