本文整理汇总了C++中Context::GetQuery方法的典型用法代码示例。如果您正苦于以下问题:C++ Context::GetQuery方法的具体用法?C++ Context::GetQuery怎么用?C++ Context::GetQuery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Context
的用法示例。
在下文中一共展示了Context::GetQuery方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExecDataAccess
bool FlowController::ExecDataAccess(Context &ctx, long &execTime) {
StartTrace(FlowController.ExecDataAccess);
execTime = 0;
bool boRet = false;
if (ctx.GetQuery().IsDefined("DataAccess")) {
String daName = ctx.GetQuery()["DataAccess"].AsString();
Trace("using DA: " << daName);
DataAccess da(daName);
DiffTimer timer;
boRet = da.StdExec(ctx);
execTime = timer.Diff();
}
return boRet;
}
示例2: RenderAll
void SessionInfoRenderer::RenderAll(std::ostream &reply, Context &c, const ROAnything &config)
{
String roleName;
c.GetRole()->GetName(roleName);
reply << "/sessionId \"" << c.GetSession()->GetId() << "\"" << std::endl;
reply << "/role " << roleName << std::endl;
reply << "/delayed " << ROAnything(c.GetQuery())["delayedIndex"].AsLong(-1) << std::endl;
}
示例3: DoAction
bool LoginAction::DoAction(String &action, Context &c)
{
Anything query = c.GetQuery();
if (query["LoginName"] == "Coast") {
action = "GoCustomerAction";
} else {
action = "Logout";
}
return true;
}
示例4: FindServiceName
String RendererDispatcher::FindServiceName(Context &ctx) {
StartTrace(RendererDispatcher.FindServiceName);
ROAnything uriPrefixList(ctx.Lookup("URIPrefix2ServiceMap"));
String requestURI(ctx.Lookup("REQUEST_URI", ""));
Anything query(ctx.GetQuery());
SubTraceAny(uriPrefixList, uriPrefixList, "Service Prefixes: ");
long matchedPrefix = FindURIPrefixInList(requestURI, uriPrefixList);
if (matchedPrefix >= 0) {
String service;
Renderer::RenderOnString(service, ctx, uriPrefixList[matchedPrefix]);
query["Service"] = service;
query["URIPrefix"] = uriPrefixList.SlotName(matchedPrefix);
SubTraceAny(query, query, "Query: ");
Trace("Service [" << service << "]");
return service;
} else if (uriPrefixList.GetSize() > 0) {
query["Error"] = String("Service[").Append(requestURI.SubString(0, requestURI.StrChr('/', 1))).Append("]NotFound");
}
String defaultHandler(ServiceDispatcher::FindServiceName(ctx));
Trace("Service:<" << defaultHandler << ">");
return defaultHandler;
}
示例5: DoTestWithContext
void ConfiguredActionTest::DoTestWithContext(Anything testCase, const String &testCaseName, Context &ctx) {
StartTrace(ConfiguredActionTest.DoTestWithContext);
TraceAny(testCase, "Config of " << testCaseName);
AlterTestStoreHook(testCase);
coast::testframework::PutInStore(testCase["SessionStore"], ctx.GetSessionStore());
coast::testframework::PutInStore(testCase["RoleStore"], ctx.GetRoleStoreGlobal());
// Can not use real Session Store because Lookup does not find it ! - fix me
TraceAny(ctx.GetRoleStoreGlobal(), "SessionStore");
coast::testframework::PutInStore(testCase["TmpStore"], ctx.GetTmpStore());
coast::testframework::PutInStore(testCase["Query"], ctx.GetQuery());
coast::testframework::PutInStore(testCase["Env"], ctx.GetEnvStore());
if (!testCase.IsDefined("Server") && GetConfig().IsDefined("Server")) {
testCase["Server"] = GetConfig()["Server"].DeepClone();
}
if (testCase.IsDefined("Server")) {
Server *s = Server::FindServer(testCase["Server"].AsCharPtr("Server"));
ctx.SetServer(s);
}
if (testCase.IsDefined("Page")) {
ctx.Push(testCase["Page"].AsCharPtr("Page"), Page::FindPage(testCase["Page"].AsCharPtr("Page")));
}
if (testCase.IsDefined("Role")) {
ctx.Push(testCase["Role"].AsCharPtr("Role"), Role::FindRole(testCase["Role"].AsCharPtr("Role")));
}
TraceAny(testCase["TmpStore"], "Language");
if (testCase["TmpStore"].IsDefined("Language")) {
ctx.SetLanguage(testCase["TmpStore"]["Language"].AsCharPtr("D"));
}
bool expected = testCase["ExpectedResult"].AsBool(true);
String token = testCase["StartToken"].AsString("TheAction");
t_assertm(expected == Action::ExecAction(token, ctx, testCase["TheAction"]), (const char *)testCaseName);
TraceAny(ctx.GetTmpStore(), "tmp store after action");
String expectedToken = testCase["ExpectedToken"].AsString("TheAction");
assertEqualm(expectedToken, token, (const char *)testCaseName);
}