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


C++ Url类代码示例

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


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

示例1: url

OsStatus
UpdateMessageStatesCGI::handleWebRequest( UtlString* out )
{
    // Instantiate the mailbox manager
    UtlString redirectUrl, dynamicHtml ;
    MailboxManager* pMailboxManager = MailboxManager::getInstance();
    OsStatus result = pMailboxManager->getMediaserverURLForWeb( redirectUrl ) ;

    if( result == OS_SUCCESS )
    {
       // We have revised the links that invoke this CGI pathway
       // so that the messageId parameter is now just the eight-digit
       // message ID.
       UtlString messageId = m_messageIds;

       result = pMailboxManager->updateMessageStates(
          m_mailboxIdentity, m_category, messageId);

       // URL of the message WAV file
       Url url ( m_mailboxIdentity );
       UtlString userId;
       url.getUserId( userId );

       // Null HTML file.
       dynamicHtml  =   HTML_BEGIN \
          HTML_END ;
    }
    else
    {
        dynamicHtml =   HTML_BEGIN \
                        PROTOCOL_MISMATCH \
                        HTML_END ;
    }

    if (out)
        {
                out->remove(0);
                out->append(dynamicHtml.data());
        }

    OsSysLog::add(FAC_MEDIASERVER_CGI, PRI_DEBUG,
                  "UpdateMessageStatesCGI::handleWebRequest: out = '%s'",
                  out->data());
    return OS_SUCCESS;
}
开发者ID:chemeris,项目名称:sipxecs,代码行数:45,代码来源:UpdateMessageStatesCGI.cpp

示例2: TEST_F

// TODO reenable test
TEST_F(ClockSkewTest, DISABLED_checkClockSkew) {
    Logger logger("ClockSkewTest");

    // Get the location of the bounce proxy
    Url bounceurl = messagingSettings->getBounceProxyUrl().getTimeCheckUrl();
    ASSERT_TRUE(bounceurl.isValid());
    std::string urlString = bounceurl.toString();
    const char *url  = urlString.c_str();

    // Use libcurl to get the HTTP date from the bounce proxy server
    CURL *curl = curl_easy_init();
    if (!curl) {
        JOYNR_LOG_ERROR(logger, "unknown error during curl_easy_init");
        FAIL();
    }

    // The line below contains a macro that is marked invalid by the QTCreator parser
    // but compiles without problem
    curl_easy_setopt(curl, CURLOPT_URL, url);
    curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, getHTTPHeaderDate);
    curl_easy_setopt(curl, CURLOPT_TIMEOUT, 30);

    // This call will fail but only the date header is interesting
    curl_easy_perform(curl);
    curl_easy_cleanup(curl);

    // Was a date obtained?
    ASSERT_FALSE(datestr[0] == '\0') << "Could not read date from bounce proxy";

    // Parse the returned date using curl
    time_t epochsecs = curl_getdate(datestr, nullptr);

    ASSERT_FALSE(epochsecs < -1) << "Could not parse date from bounce proxy.";

    // Compare the time with the local time
    std::uint64_t now        = DispatcherUtils::nowInMilliseconds();
    std::uint64_t remoteTime = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::from_time_t(epochsecs).time_since_epoch()).count();

    auto minMaxTime = std::minmax(now, remoteTime);
    std::uint64_t diff = minMaxTime.second - minMaxTime.first;

    JOYNR_LOG_INFO(logger, "Time difference is {}  msecs",now);
    EXPECT_TRUE(diff < 2000) << "Time difference between local and remote is over 2 seconds";

}
开发者ID:icyerasor,项目名称:joynr,代码行数:46,代码来源:ClockSkewTest.cpp

示例3: getDiscriminatingTagValue

UtlString SessionContext::getDiscriminatingTagValue( const SipMessage& message, bool bFromCallerToCallee ) const
{
   UtlString discriminatingTag;
   Url tempUrl;

   if( bFromCallerToCallee )
   {
      // caller-to-callee uses To-tag to distinguish between dialogs
      message.getToUrl( tempUrl );
   }
   else
   {
      // callee-to-caller uses From-tag to distinguish between dialogs
      message.getFromUrl( tempUrl );
   }
   tempUrl.getFieldParameter( "tag", discriminatingTag );
   return discriminatingTag;
}
开发者ID:LordGaav,项目名称:sipxecs,代码行数:18,代码来源:SessionContext.cpp

示例4: remote_object

bool Command::remote_object(const Url &remote_url, Value *error, ObjectHandle *handle) {
  Object *object;
  if (remote_objects_.get(remote_url.str(), &object)) {
    handle->hold(object);
    return true;
  } else {
    return build_remote_object(remote_url, error, handle);
  }
}
开发者ID:aspeteRakete,项目名称:oscit,代码行数:9,代码来源:command.cpp

示例5: getPreferredContactUri

UtlBoolean SipLine::getPreferredContactUri(Url& preferredContactUri) const
{
    UtlString host ; 

    preferredContactUri = mPreferredContactUri ;
    preferredContactUri.getHostAddress(host) ;

    return (host.length() > 0) ;
}
开发者ID:mranga,项目名称:sipxecs,代码行数:9,代码来源:SipLine.cpp

示例6: testGetUnexpiredContacts

   void testGetUnexpiredContacts()
      {
         Url uri;
         ResultSet results;
         UtlHashMap record1;
         UtlHashMap record2;
         int timeNow = (int)OsDateTime::getSecsSinceEpoch();

         RegistrationDbTestContext testDbContext(TEST_DATA_DIR "/regdbdata",
                                                 TEST_WORK_DIR "/regdbdata"
                                                 );

         testDbContext.inputFile("getUnexpiredContacts.xml");

         RegistrationDB* regDb = RegistrationDB::getInstance();

         uri.setUserId("900");
         uri.setHostAddress("testdomain.example.com");


         regDb->getUnexpiredContactsUser(uri, timeNow, results);
         int numResults = results.getSize();
         CPPUNIT_ASSERT_EQUAL(2, numResults);


         if (numResults == 2)
         {
             // Get first record
             results.getIndex(0, record1);
             UtlString* value = (UtlString*)record1.findValue(&RegistrationDB::gContactKey);
             CPPUNIT_ASSERT_EQUAL(value->compareTo("sip:[email protected]"), 0);

             value = (UtlString*)record1.findValue(&RegistrationDB::gUriKey);
             CPPUNIT_ASSERT_EQUAL(value->compareTo("sip:[email protected]"), 0);

             // Get second record
             results.getIndex(1, record2);
             value = (UtlString*)record2.findValue(&RegistrationDB::gContactKey);
             CPPUNIT_ASSERT_EQUAL(value->compareTo("sip:[email protected]"), 0);

             value = (UtlString*)record2.findValue(&RegistrationDB::gUriKey);
             CPPUNIT_ASSERT_EQUAL(value->compareTo("sip:[email protected]"), 0);
         }
      }
开发者ID:LordGaav,项目名称:sipxecs,代码行数:44,代码来源:RegistryDbTest.cpp

示例7: buildSubscribeRequest

void SipImpliedSubscriptions::buildSubscribeRequest( const SipMessage& registerMessage
                           ,int duration
                           ,SipMessage& subscribeRequest
                           ,UtlString&  callId
                           ,UtlString&  fromTag
                           ,UtlString&  fromUri
                           )
{
   UtlString registrationValue;
   UtlString tagNameValuePair;
   UtlString contactUri;
   int      sequenceNumber = 0;

   // Get the From URL, and change the tag
   Url fromUrl;
   registerMessage.getFromUrl( fromUrl );
   fromUrl.removeFieldParameter("tag"); // discard from tag from REGISTER
   registerMessage.getFromUri( &fromUri );
   (void) registerMessage.getContactUri(0, &contactUri);
   (void) registerMessage.getCSeqField(&sequenceNumber, &registrationValue);

   Url toUrl;
   registerMessage.getToUrl( toUrl );
   toUrl.removeFieldParameter("tag");
   
   UtlString toUri;
   registerMessage.getToUri( &toUri );

   registerMessage.getCallIdField( &callId );
   callId.prepend("implied-mwi-");

   // Build a from tag for the SUBSCRIBE
   //   - hash the call id so that it will be the same on each refresh
   UtlString callIdHash;
   NetMd5Codec::encode( callId.data(), callIdHash );
   fromUrl.setFieldParameter("tag", callIdHash.data() );
   fromTag = callIdHash; // for constructing the nonce

   subscribeRequest.setVoicemailData( fromUrl.toString() // From:
                                     ,toUrl.toString()   // To:
                                     ,toUri.data()       // request URI
                                     ,contactUri.data()  // taken from registration
                                     ,callId.data()
                                     ,++sequenceNumber
                                     ,duration
                                     );

   /*
    * Rewrite the event field to add our extension parameter to
    * ensure that the registration and subscription are synchronized.
    */
   const char* standardEventHeader = subscribeRequest.getHeaderValue(0, SIP_EVENT_FIELD);
   UtlString extendedEventHeader(standardEventHeader);
   extendedEventHeader.append(";" SIPX_IMPLIED_SUB "=");
   char durationString[12];
   sprintf(durationString, "%d", duration);
   extendedEventHeader.append(durationString);
   subscribeRequest.setHeaderValue(SIP_EVENT_FIELD, extendedEventHeader.data(), 0);
}
开发者ID:chemeris,项目名称:sipxecs,代码行数:59,代码来源:SipImpliedSubscriptions.cpp

示例8: testLocalStrictRoute

   void testLocalStrictRoute()
      {
         const char* message =
            "INVITE sip:example.com;lr SIP/2.0\r\n"
            "Route: <sip:[email protected]>\r\n"
            "Via: SIP/2.0/TCP 10.1.1.3:33855\r\n"
            "To: sip:use[email protected]\r\n"
            "From: Caller <sip:[email protected]>; tag=30543f3483e1cb11ecb40866edd3295b\r\n"
            "Call-Id: f88dfabce84b6a2787ef024a7dbe8749\r\n"
            "Cseq: 1 INVITE\r\n"
            "Max-Forwards: 20\r\n"
            "Contact: [email protected]\r\n"
            "Content-Length: 0\r\n"
            "\r\n";

         SipMessage testMsg(message, strlen(message));
         Url requestUri;
         UtlSList removedRoutes;

         testMsg.normalizeProxyRoutes(UserAgent, requestUri, &removedRoutes);

         UtlString normalizedMsg;
         int msgLen;
         testMsg.getBytes(&normalizedMsg, &msgLen);

         const char* expectedMessage = // route header removed, uri swapped
            "INVITE sip:[email protected] SIP/2.0\r\n"
            "Via: SIP/2.0/TCP 10.1.1.3:33855\r\n"
            "To: sip:[email protected]\r\n"
            "From: Caller <sip:[email protected]>; tag=30543f3483e1cb11ecb40866edd3295b\r\n"
            "Call-Id: f88dfabce84b6a2787ef024a7dbe8749\r\n"
            "Cseq: 1 INVITE\r\n"
            "Max-Forwards: 20\r\n"
            "Contact: [email protected]\r\n"
            "Content-Length: 0\r\n"
            "\r\n";

         ASSERT_STR_EQUAL(expectedMessage, normalizedMsg.data());

         UtlString requestUriResult;
         requestUri.toString(requestUriResult);
         
         ASSERT_STR_EQUAL("sip:[email protected]", requestUriResult.data());
      }
开发者ID:John-Chan,项目名称:sipXtapi,代码行数:44,代码来源:SipProxyMessageTest.cpp

示例9: getUrl

// returns false if blocked, true otherwise, like on quick connect error
bool getUrl( char *path , long checkCRC = 0 , char *post = NULL ) {

	SafeBuf sb;
	sb.safePrintf ( "http://%s:%li%s"
			, iptoa(g_hostdb.m_myHost->m_ip)
			, (long)g_hostdb.m_myHost->m_httpPort
			, path
			);

	s_checkCRC = checkCRC;

	bool doPost = true;
	if ( strncmp ( path , "/search" , 7 ) == 0 )
		doPost = false;

	//Url u;
	s_url.set ( sb.getBufStart() );
	log("qa: getting %s",sb.getBufStart());
	if ( ! g_httpServer.getDoc ( s_url.getUrl() ,
				     0 , // ip
				     0 , // offset
				     -1 , // size
				     0 , // ifmodsince
				     NULL ,
				     gotReplyWrapper,
				     999999*1000, // timeout ms
				     0, // proxyip
				     0, // proxyport
				     -1, // maxtextdoclen
				     -1, // maxotherdoclen
				     NULL , // useragent
				     "HTTP/1.0" , // protocol
				     doPost , // doPost
				     NULL , // cookie
				     NULL , // additionalHeader
				     NULL , // fullRequest
				     post ) )
		return false;
	// error?
	processReply ( NULL , 0 );
	//log("qa: getUrl error: %s",mstrerror(g_errno));
	return true;
}	
开发者ID:firatkarakusoglu,项目名称:open-source-search-engine,代码行数:44,代码来源:qa.cpp

示例10: _doReverseNetTest

static bool _doReverseNetTest(
   Node* node, Config& cfg, UserId userId, const char* token,
   string& serverUrl)
{
   bool rval = false;

   // start creating public server URL
   serverUrl = "https://";

   // setup post data, use blank host to indicate to the reverse netaccess
   // service that our public IP should be used in the netaccess test
   // use a 15 seconds timeout in waiting for a response
   DynamicObject out;
   out["host"] = "";
   out["port"] = cfg["port"];
   out["path"] = "/api/3.0/catalog/netaccess/test";
   out["sellerId"] = userId;
   out["token"] = token;
   out["timeout"] = 15;

   DynamicObject in;

   // post to bitmunk
   Url url;
   url.format("/api/3.0/catalog/netaccess/rtest");
   Messenger* m = node->getMessenger();
   if(m->postSecureToBitmunk(&url, &out, &in, userId))
   {
      rval = true;
      serverUrl.append(in["ip"]->getString());
      serverUrl.push_back(':');
      serverUrl.append(cfg["port"]->getString());

      // send event
      Event ev;
      ev["type"] = EVENT_NET_ACCESS_SUCCESS;
      ev["details"]["userId"] = userId;
      ev["details"]["serverUrl"] = serverUrl.c_str();
      node->getEventController()->schedule(ev);
   }

   return rval;
}
开发者ID:digitalbazaar,项目名称:bitmunk,代码行数:43,代码来源:ListingUpdater.cpp

示例11: loadUrlStream

//////////////////////////////////////////////////////////////////////////////////////////////////////
// loadUrl
IStreamUrlRef loadUrlStream( const Url &url )
{
	try {
		IStreamUrlRef result = IStreamUrl::createRef( url.str(), "", "" );
		return result;
	}
	catch( ... ) {
		return IStreamUrlRef();
	}
}
开发者ID:alexbw,项目名称:Cinder,代码行数:12,代码来源:Url.cpp

示例12: child_state

Slime child_state(const StateExplorer &state, const Url &url) {
    Slime child_state;
    state.get_state(slime::SlimeInserter(child_state), false);
    if (child_state.get().type().getId() == slime::NIX::ID) {
        inject_children(state, url, child_state.setObject());
    } else {
        child_state.get().setString("url", url.get());
    }
    return child_state;
}
开发者ID:songhtdo,项目名称:vespa,代码行数:10,代码来源:generic_state_handler.cpp

示例13: get

bool ContactList::get( size_t index, Url& contactUrl ) const
{
   UtlString contactAsString;
   bool success = get( index, contactAsString );
   if( success )
   {
      contactUrl.fromString( contactAsString );
   }
   return success;
}
开发者ID:astubbs,项目名称:sipxecs,代码行数:10,代码来源:RedirectPlugin.cpp

示例14: main

int main(int argc, char **argv) {
	if (argc < 2) {
		print_usage(argv[0]);
		return 1;
	}

	if (strcmp(argv[1], "--h") == 0 || strcmp(argv[1], "--help") == 0 ) {
		print_usage(argv[0]);
		return 1;
	}

	// initialize library
	g_mem.init();
	hashinit();

	g_conf.init(NULL);

	g_log.m_logPrefix = false;

	const char *input = argv[1];
	size_t inputLen = strlen(input);

	Url url;
	url.set(input, inputLen);
	url.print();
	logf(LOG_TRACE, "\t");

	SiteGetter sg;
	sg.getSite(input, NULL, 0, 0, 0);
	logf(LOG_TRACE, "Site info");
	logf(LOG_TRACE, "\tsite         : %.*s", sg.getSiteLen(), sg.getSite());
	logf(LOG_TRACE, "\tsitehash32   : %" PRIx32, hash32(sg.getSite(), sg.getSiteLen(), 0));
	logf(LOG_TRACE, "\t");

	uint64_t probableDocId = Titledb::getProbableDocId(&url);
	logf(LOG_TRACE, "Document info");
	logf(LOG_TRACE, "\tprobabledocid      : %" PRIu64, probableDocId);
	logf(LOG_TRACE, "\tfirstprobabledocid : %" PRIu64, Titledb::getFirstProbableDocId(probableDocId));
	logf(LOG_TRACE, "\tlastprobabledocid  : %" PRIu64, Titledb::getLastProbableDocId(probableDocId));

	return 0;
}
开发者ID:privacore,项目名称:open-source-search-engine,代码行数:42,代码来源:print_urlinfo.cpp

示例15: ClearScene

/**
*  @brief
*    Loads a resource which type has to be evaluated internally
*/
bool Application::LoadResource(const String &sFilename, const String &sType)
{
	bool bResult = false;	// Error by default

	// Clear the scene, after calling this method the scene is empty
	ClearScene();

	// Destroy the currently used script
	DestroyScript();

	// Backup the filename of the current resource
	m_sResourceFilename = sFilename;

	// Is there anything to load in?
	if (sFilename.GetLength()) {
		{ // Make the directory of the scene to load in to the current directory

			// Ok, the next thing is tricky, and every solution will end up in being a hack due to lack of information.
			// Within materials, meshes etc. there are usually relative paths provided, no absolute (not just true for PixelLight file formats).
			// Further, those paths are usually relative to a project root resulting e.g. within a default directory layout like
			// - Root
			//   - Data
			//     - Meshes
			//     - Materials
			// For "normal" projects this is no issue because everything is usually relative to the root project directory...
			// ... but this viewer must be able to pick out e.g. a mesh out of nowhere and must still be able to locate the required
			// other resources like materials. So, in here, we can only work with heuristics... this can and will of course go from
			// time to time horribly wrong...

			// First try: Find the first "Data" occurrence with the given filename and hope that it's the project root directory

			// Get filename as clean URL
			Url cUrl = Url(sFilename);
			cUrl.Collapse();

			// Get the first part of the path, and then look for "Data"
			uint32 nPathPos = 0;
			String sPart = cUrl.GetFirstPath(nPathPos);
			while (sPart != "Data" && sPart.GetLength())
				sPart = cUrl.GetNextPath(nPathPos);
			if (sPart == "Data") {
				// Set the base directory of the application
				SetBaseDirectory(cUrl.GetRoot() + cUrl.GetPath().GetSubstring(0, nPathPos - 5));	// -5 = Remove "Data/"
			} else {
				// Second try: Cut of "/Data/Scenes/" and hope that it's the project root directory.
				// If it's not there, take the directory the given resource is in.

				// Validate path
				const String sDirectory = cUrl.CutFilename();

				// Search for "/Data/Scenes/" and get the prefix of that, in case it's not there just use directly the scene directory
				const int nIndex = sDirectory.IndexOf("/Data/Scenes/");

				// Set the base directory of the application
				SetBaseDirectory("file://" + ((nIndex >= 0) ? sDirectory.GetSubstring(0, nIndex) : sDirectory) + '/');
			}
		}
开发者ID:ByeDream,项目名称:pixellight,代码行数:61,代码来源:Application.cpp


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