本文整理汇总了C++中CCgiContext::GetStreamStatus方法的典型用法代码示例。如果您正苦于以下问题:C++ CCgiContext::GetStreamStatus方法的具体用法?C++ CCgiContext::GetStreamStatus怎么用?C++ CCgiContext::GetStreamStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCgiContext
的用法示例。
在下文中一共展示了CCgiContext::GetStreamStatus方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessRequest
int CCgiSampleApplication::ProcessRequest(CCgiContext& ctx)
{
// Parse, verify, and look at cmd-line and CGI parameters via "CArgs"
// (optional)
x_LookAtArgs();
// Given "CGI context", get access to its "HTTP request" and
// "HTTP response" sub-objects
const CCgiRequest& request = ctx.GetRequest();
CCgiResponse& response = ctx.GetResponse();
/*
// To get CGI client API (in-house only, optional)
const char* const* client_tracking_env = request.GetClientTrackingEnv();
unsigned int client_ip = NcbiGetCgiClientIP(eCgiClientIP_TryAll,
client_tracking_env);
int is_local_client = NcbiIsLocalCgiClient(client_tracking_env);
*/
// Try to retrieve the message ('message=...') from the HTTP request.
// NOTE: the case sensitivity was turned off in Init().
bool is_message = false;
string message = request.GetEntry("Message", &is_message);
if ( is_message ) {
message = "'" + message + "'";
} else {
message = "<NONE>";
}
// NOTE: While this sample uses the CHTML* classes for generating HTML,
// you are encouraged to use XML/XSLT and the NCBI port of XmlWrapp.
// For more info:
// http://www.ncbi.nlm.nih.gov/books/NBK8829/
// http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/namespacexml.html
// Create a HTML page (using template HTML file "cgi_sample.html")
auto_ptr<CHTMLPage> page;
try {
page.reset(new CHTMLPage("Sample CGI", "cgi_sample.html"));
} catch (exception& e) {
ERR_POST("Failed to create Sample CGI HTML page: " << e.what());
return 2;
}
// Register substitution for the template parameters <@[email protected]> and
// <@[email protected]>
try {
CHTMLPlainText* text = new CHTMLPlainText(message);
_TRACE("foo");
page->AddTagMap("MESSAGE", text);
CHTMLPlainText* self_url = new CHTMLPlainText(ctx.GetSelfURL());
page->AddTagMap("SELF_URL", self_url);
}
catch (exception& e) {
ERR_POST("Failed to populate Sample CGI HTML page: " << e.what());
return 3;
}
// Compose and flush the resultant HTML page
try {
_TRACE("stream status: " << ctx.GetStreamStatus());
response.WriteHeader();
page->Print(response.out(), CNCBINode::eHTML);
} catch (exception& e) {
ERR_POST("Failed to compose/send Sample CGI HTML page: " << e.what());
return 4;
}
return 0;
}