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


C++ HTMLForm::load方法代码示例

本文整理汇总了C++中HTMLForm::load方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLForm::load方法的具体用法?C++ HTMLForm::load怎么用?C++ HTMLForm::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTMLForm的用法示例。


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

示例1: run

void BundleInstallHandler::run()
{
	ServiceRef::Ptr pInstallerRef = context()->registry().findByName(BundleInstallerService::SERVICE_NAME);
	AutoPtr<BundleInstallerService> pInstaller = pInstallerRef->castedInstance<BundleInstallerService>();

	HTMLForm form;
	InstallPartHandler partHandler(form, pInstaller);
	form.load(request(), request().stream(), partHandler);

	std::string title;
	std::string backLink;
	std::string backLinkTitle;
	std::string symbolicName = form.get("symbolicName", "");
	if (!symbolicName.empty())
	{
		Bundle::Ptr pBundle = context()->findBundle(symbolicName);
		title = text("upgradeBundle");
		title += ": ";
		title += symbolicName;
		backLink = bundlePath(symbolicName);
		backLinkTitle = text("bundle");
		backLinkTitle += ": ";
		backLinkTitle += pBundle->name();
	}
	else
	{
		title = text("installBundle");
		backLink = bundle()->properties().getString("web.path");
		backLinkTitle = text("installedBundles");
	}
		
	beginPage(title, backLink, backLinkTitle);
	if (partHandler.installed())
	{
		templat().clear();
		templat().setString("symbolicName", partHandler.bundle()->symbolicName());
		templat().setString("name", partHandler.bundle()->name());
		sendTemplate("html.installComplete");
		beginList();
		item(text("id"), NumberFormatter::format(partHandler.bundle()->id()));
		item(text("symbolicName"), partHandler.bundle()->symbolicName());
		item(text("version"), partHandler.bundle()->version().toString());
		item(text("path"), partHandler.bundle()->path());
		endList();
	}
	else if (symbolicName.empty())
	{
		sendTemplate("html.installForm");
	}
	else
	{
		templat().clear();
		templat().setString("symbolicName", symbolicName);
		sendTemplate("html.upgradeForm");
	}
	endPage();
}
开发者ID:JoneXie,项目名称:macchina.io,代码行数:57,代码来源:BundleInstallHandler.cpp

示例2: testFieldLimitUrl

void HTMLFormTest::testFieldLimitUrl()
{
	HTTPRequest req("GET", "/form.cgi?field1=value1&field2=value%202&field3=value%3D3&field4=value%264");
	HTMLForm form;
	form.setFieldLimit(3);
	try
	{
		form.load(req);
		fail("field limit violated - must throw");
	}
	catch (Poco::Net::HTMLFormException&)
	{
	}
}
开发者ID:119,项目名称:vdc,代码行数:14,代码来源:HTMLFormTest.cpp

示例3: testFieldLimitMultipart

void HTMLFormTest::testFieldLimitMultipart()
{
	std::istringstream istr(
		"\r\n"
		"--MIME_boundary_0123456789\r\n"
		"Content-Disposition: form-data; name=\"field1\"\r\n"
		"\r\n"
		"value1\r\n"
		"--MIME_boundary_0123456789\r\n"
		"Content-Disposition: form-data; name=\"field2\"\r\n"
		"\r\n"
		"value 2\r\n"
		"--MIME_boundary_0123456789\r\n"
		"Content-Disposition: form-data; name=\"field3\"\r\n"
		"\r\n"
		"value=3\r\n"
		"--MIME_boundary_0123456789\r\n"
		"Content-Disposition: form-data; name=\"field4\"\r\n"
		"\r\n"
		"value&4\r\n"
		"--MIME_boundary_0123456789\r\n"
		"Content-Disposition: file; name=\"attachment1\"; filename=\"att1.txt\"\r\n"
		"Content-Type: text/plain\r\n"
		"\r\n"
		"This is an attachment\r\n"
		"--MIME_boundary_0123456789--\r\n"
	);
	HTTPRequest req("POST", "/form.cgi");
	req.setContentType(HTMLForm::ENCODING_MULTIPART + "; boundary=\"MIME_boundary_0123456789\"");
	StringPartHandler sah;
	HTMLForm form;
	form.setFieldLimit(3);
	try
	{
		form.load(req, istr, sah);	
		fail("field limit violated - must throw");
	}
	catch (Poco::Net::HTMLFormException&)
	{
	}
}
开发者ID:119,项目名称:vdc,代码行数:41,代码来源:HTMLFormTest.cpp


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