本文整理汇总了C++中Poco::URI方法的典型用法代码示例。如果您正苦于以下问题:C++ Poco::URI方法的具体用法?C++ Poco::URI怎么用?C++ Poco::URI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Poco
的用法示例。
在下文中一共展示了Poco::URI方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: buildAuthHeader
std::string OAuthPrivate::buildAuthHeader(const std::string & method, const std::string & url, Params data, const std::string & verifier){
Params params;
params.insert(std::pair<std::string, std::string>("oauth_consumer_key", consumerKey));
params.insert(std::pair<std::string, std::string>("oauth_nonce", Helper::identifier(42)));
//params.insert(std::pair<std::string, std::string>("oauth_nonce", "Qr2DJzLO3iZCRnqN7hRvJCX5VZFk62fh2Qrbx3Snzl"));
params.insert(std::pair<std::string, std::string>("oauth_signature_method", "HMAC-SHA1"));
params.insert(std::pair<std::string, std::string>("oauth_timestamp", NumberFormatter::format(Helper::timestamp())));
//params.insert(std::pair<std::string, std::string>("oauth_timestamp", "1363740223"));
params.insert(std::pair<std::string, std::string>("oauth_version", "1.0"));
if(!verifier.empty())
params.insert(std::pair<std::string, std::string>("oauth_verifier", verifier));
if(!oauthToken.empty())
params.insert(std::pair<std::string, std::string>("oauth_token", oauthToken));
params.insert(data.begin(), data.end());
params.insert(std::pair<std::string, std::string>("oauth_signature", signature(signingKey(consumerSecret, oauthTokenSecret), baseString(method, url, paramsString(params)))));
std::string authStr;
ParamsIterator it;
for(it = params.begin(); it != params.end(); it++){
std::string key = (*it).first;
std::string val = (*it).second;
authStr += URI(key).toString() + "=\"" + Helper::urlencode(val) + "\", ";
}
return authStr.substr(0, authStr.length() - 2);
}
示例2: dispatch
void RootReqDispatcher::dispatch(const Poco::Net::HTTPServerRequest& procReq,
Poco::Net::HTTPServerResponse &out)
{
using Poco::URI;
using std::string;
using std::vector;
// Construyo una URI
URI uri(procReq.getURI());
// Obtengo los segmentos del path
vector<string> pathSegs;
uri.getPathSegments(pathSegs);
if (pathSegs.size() == 0)
pathSegs.push_back(""); // Por consistencia
// Uso el primer segmento para determinar a donde despachar
TDispatchMap::iterator itDisp = dispatchMap_.find(pathSegs[0]);
// Si no encontré a donde mandarlo, es error
if (itDisp == dispatchMap_.end())
{
pErrorReqProc_->process(URI("/error?code=404"), out);
return;
}
// Lo mando a donde corresponda
itDisp->second->process(procReq, out);
}
示例3: createRequestHandler
HTTPRequestHandler* createRequestHandler(const HTTPServerRequest& request)
{
std::string localPath;
std::string uriPath = URI(request.getURI()).getPath();
if (fileExists(request, localPath)) // request for a file
return new FileRequestHandler(localPath);
else if ((uriPath == "/html") || (uriPath == "/xml")) // request for data
return new DataRequestHandler();
else // sorry ...
return new NotFoundRequestHandler();
}
示例4: paramsString
std::string OAuthPrivate::paramsString(Params params){
std::string paramStr;
ParamsIterator it;
for(it = params.begin(); it != params.end(); it++){
std::string key = (*it).first;
std::string val = (*it).second;
paramStr += URI(key).toString() + "=" + Helper::urlencode(val) + "&";
}
return paramStr.substr(0, paramStr.length() - 1);
}
示例5: signingKey
std::string OAuthPrivate::signingKey(const std::string & consumerSecretKey, const std::string & oauthTokenSecretKey){
return URI(consumerSecretKey).toString() + "&" + URI(oauthTokenSecretKey).toString();
}
示例6: HandleURI
void HandleURI(const std::string& name, const std::string& value)
{
uri = URI(value);
}