本文整理汇总了C++中llhttpnode::ResponsePtr类的典型用法代码示例。如果您正苦于以下问题:C++ ResponsePtr类的具体用法?C++ ResponsePtr怎么用?C++ ResponsePtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ResponsePtr类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get
// virtual
void LLHTTPNode::get(LLHTTPNode::ResponsePtr response, const LLSD& context) const
{
try
{
response->result(simpleGet());
}
catch (NotImplemented)
{
response->methodNotAllowed();
}
}
示例2: post
// virtual
void LLHTTPNode::post(LLHTTPNode::ResponsePtr response, const LLSD& context, const LLSD& input) const
{
try
{
response->result(simplePost(input));
}
catch (NotImplemented)
{
response->methodNotAllowed();
}
}
示例3: get
virtual void get(
LLHTTPNode::ResponsePtr response,
const LLSD& context) const
{
std::string name = context["request"]["wildcard"]["option-name"];
response->result(LLApp::instance()->getOption(name));
}
示例4: post
virtual void post(
LLHTTPNode::ResponsePtr response,
const LLSD& context,
const LLSD& input) const
{
LLSD result = LLApp::instance()->getOptionData(
LLApp::PRIORITY_RUNTIME_OVERRIDE);
LLSD::map_const_iterator iter = input.beginMap();
LLSD::map_const_iterator end = input.endMap();
for(; iter != end; ++iter)
{
result[(*iter).first] = (*iter).second;
}
LLApp::instance()->setOptionData(
LLApp::PRIORITY_RUNTIME_OVERRIDE,
result);
response->result(result);
}
示例5: post
void LLTrustedMessageService::post(LLHTTPNode::ResponsePtr response,
const LLSD& context,
const LLSD& input) const
{
std::string name = context["request"]["wildcard"]["message-name"];
std::string senderIP = context["request"]["remote-host"];
std::string senderPort = context["request"]["headers"]
["x-GIS-udp-listen-port"];
LLSD message_data;
std::string sender = senderIP + ":" + senderPort;
message_data["sender"] = sender;
message_data["body"] = input;
// untrusted senders should not have access to the trusted message
// service, but this can happen in development, so check and warn
LLMessageConfig::SenderTrust trust =
LLMessageConfig::getSenderTrustedness(name);
if ((trust == LLMessageConfig::TRUSTED ||
(trust == LLMessageConfig::NOT_SET &&
gMessageSystem->isTrustedMessage(name)))
&& !gMessageSystem->isTrustedSender(LLHost(sender)))
{
LL_WARNS("Messaging") << "trusted message POST to /trusted-message/"
<< name << " from unknown or untrusted sender "
<< sender << llendl;
response->status(403, "Unknown or untrusted sender");
}
else
{
gMessageSystem->receivedMessageFromTrustedSender();
if (input.has("binary-template-data"))
{
llinfos << "Dispatching template: " << input << llendl;
// try and send this message using udp dispatch
LLMessageSystem::dispatchTemplate(name, message_data, response);
}
else
{
llinfos << "Dispatching without template: " << input << llendl;
LLMessageSystem::dispatch(name, message_data, response);
}
}
}
示例6: makeRequest
std::string makeRequest(
const std::string& name,
const std::string& httpRequest,
bool timeout = false)
{
LLPipeStringInjector* injector = new LLPipeStringInjector(httpRequest);
LLPipeStringExtractor* extractor = new LLPipeStringExtractor();
apr_pool_t* pool;
apr_pool_create(&pool, NULL);
LLPumpIO* pump;
pump = new LLPumpIO(pool);
LLPumpIO::chain_t chain;
LLSD context;
chain.push_back(LLIOPipe::ptr_t(injector));
LLIOHTTPServer::createPipe(chain, mRoot, LLSD());
chain.push_back(LLIOPipe::ptr_t(extractor));
pump->addChain(chain, DEFAULT_CHAIN_EXPIRY_SECS);
pumpPipe(pump, 10);
if(mResponse.notNull() && (! timeout))
{
mResponse->result(mResult);
mResponse = NULL;
}
pumpPipe(pump, 10);
std::string httpResult = extractor->string();
chain.clear();
delete pump;
apr_pool_destroy(pool);
if(mResponse.notNull() && timeout)
{
mResponse->result(mResult);
mResponse = NULL;
}
return httpResult;
}