本文整理汇总了C++中HttpRequest::GetParam方法的典型用法代码示例。如果您正苦于以下问题:C++ HttpRequest::GetParam方法的具体用法?C++ HttpRequest::GetParam怎么用?C++ HttpRequest::GetParam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HttpRequest
的用法示例。
在下文中一共展示了HttpRequest::GetParam方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doGetCGI
/*****************************************************************************
* Function - doGetCGI
* DESCRIPTION: HTTP GET with URL /get.cgi
****************************************************************************/
void WebIfHandler::doGetCGI(HttpRequest& req, HttpResponse& res)
{
if (req.HasParam("io_status"))
{
res.StartHTMLContent();
if (req.GetParam("io_status", "").compare("iob") == 0)
{
res << "<h2>IOB</h2><i>Status not implemented!</i>";
}
else if (req.GetParam("io_status", "").compare("io351iomodules") == 0)
{
for (int i = 0; i < sizeof(m_pIO351IOModules) / sizeof(m_pIO351IOModules[0]); i++)
{
if (i)
{
res << "<br/>";
}
res << "<h2>IO351 IO Module #" << (i + 1) << " Status</h2>";
if (m_pIO351IOModules[i])
m_pIO351IOModules[i]->webifMakeStatusHtml(res);
else
res << "<i>Pointer to IO351 IO Module not set!</i>";
}
}
else
{
res << "<b>Unhandled io_status=" << req.GetParam("io_status", "") << "</b>";
}
}
// firmware_update.html
if (req.HasParam("firmware_update"))
{
res.StartHTMLContent();
if (req.GetParam("firmware_update", "").compare("status") == 0)
{
FirmwareUpdateCtrl::GetInstance()->webifMakeStatus(res);
}
else
{
res << "<b>Unhandled firmware_update=" << req.GetParam("firmware_update", "") << "</b>";
}
}
}
示例2: doPostCGI
/*****************************************************************************
* Function - doPostCGI
* DESCRIPTION: HTTP POST with URL /post.cgi (HTML form)
****************************************************************************/
void WebIfHandler::doPostCGI(const char* szFormID, HttpRequest& req, HttpResponse& res)
{
if (strcmp(szFormID, "ip_config") == 0)
{
res.StartHTMLContent();
res << "<html><head><title>Please wait...</title>";
res << IPConfigByWeb::getInstance()->webifPostNewConfig(
req.HasParam("dhcp_enabled"),
req.GetParam("hostname", "").c_str(),
req.GetParam("ip_address", "").c_str(),
req.GetParam("subnet_mask", "").c_str(),
req.GetParam("default_gateway", "").c_str(),
req.GetParam("primary_dns", "").c_str(),
req.GetParam("secondary_dns", "").c_str()
);
res << "</head><body><i>Please wait...</i></body></html>";
}
else if (strcmp(szFormID, "pw_config") == 0)
{
res.SendRedirect(PasswordSetting::getInstance()->webifPostNewConfig(
req.GetParam("existing_password", "").c_str(),
req.GetParam("new_password", "").c_str(),
req.GetParam("repeated_password", "").c_str()
).c_str());
}
else if (strcmp(szFormID, "iostatus") == 0)
{
if (m_pIO351IOModules[0])
m_pIO351IOModules[0]->webifSetNoOfIOModules(req.GetParam("no_of_io_modules", 0, 10, 0));
res.SendRedirect("/iostatus.html");
}
// firmware_update.html
else if (strcmp(szFormID, "firmware_update") == 0)
{
FirmwareUpdateCtrl::GetInstance()->webifDoPost(req);
res.SendRedirect("/firmware_update.html");
}
}