本文整理汇总了C++中CCgiContext::GetRequest方法的典型用法代码示例。如果您正苦于以下问题:C++ CCgiContext::GetRequest方法的具体用法?C++ CCgiContext::GetRequest怎么用?C++ CCgiContext::GetRequest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCgiContext
的用法示例。
在下文中一共展示了CCgiContext::GetRequest方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IsRequested
bool CNcbiCommand::IsRequested( const CCgiContext& ctx ) const
{
const string value = GetName();
TCgiEntries& entries =
const_cast<TCgiEntries&>(ctx.GetRequest().GetEntries());
pair<TCgiEntriesI,TCgiEntriesI> p = entries.equal_range( GetEntry() );
for ( TCgiEntriesI itEntr = p.first; itEntr != p.second; ++itEntr ) {
if( AStrEquiv( value, itEntr->second, PNocase() ) ) {
return true;
} // if
} // for
// if there is no 'cmd' entry
// check the same for IMAGE value
p = entries.equal_range( NcbiEmptyString );
for ( TCgiEntriesI iti = p.first; iti != p.second; ++iti ) {
if( AStrEquiv( value, iti->second, PNocase() ) ) {
return true;
} // if
}
return false;
}
示例2: ProcessRequest
int CSoapServerApplication::ProcessRequest(CCgiContext& ctx)
{
const CCgiRequest& request = ctx.GetRequest();
CCgiResponse& response = ctx.GetResponse();
response.SetContentType("text/xml");
if (!x_ProcessWsdlRequest(response, request)) {
x_ProcessSoapRequest(response, request);
}
response.Flush();
return 0;
}
示例3: GetQueryStringValue
/* returns the string 'value' portion of the 'key=value' pairing
* in the querystring. */
inline string CSeqCommand::GetQueryStringValue(CCgiContext& ctx, const string &key)
{
TCgiEntries& entries = const_cast<TCgiEntries&> (ctx.GetRequest().GetEntries());
pair<TCgiEntriesI, TCgiEntriesI> Map = entries.equal_range(key);
string value = kEmptyStr;
for(TCgiEntriesI i = Map.first; i != Map.second; ++i)
{
value = i->second;
}
return value;
}
示例4: ProcessRequest
int CNetCacheBlobFetchApp::ProcessRequest(CCgiContext& ctx)
{
const CCgiRequest& request = ctx.GetRequest();
CCgiResponse& reply = ctx.GetResponse();
bool is_found;
string key = request.GetEntry("key", &is_found);
if (key.empty() || !is_found) {
NCBI_THROW(CArgException, eNoArg, "CGI entry 'key' is missing");
}
string fmt = request.GetEntry("fmt", &is_found);
if (fmt.empty() || !is_found)
fmt = "image/png";
string filename(request.GetEntry("filename", &is_found));
if (is_found && !filename.empty()) {
string is_inline(request.GetEntry("inline", &is_found));
reply.SetHeaderValue("Content-Disposition",
(is_found && NStr::StringToBool(is_inline) ?
"inline; filename=" : "attachment; filename=") +
filename);
}
reply.SetContentType(fmt);
reply.WriteHeader();
CNetStorageObject netstorage_object(m_NetStorage.Open(key));
char buffer[NETSTORAGE_IO_BUFFER_SIZE];
size_t total_bytes_written = 0;
while (!netstorage_object.Eof()) {
size_t bytes_read = netstorage_object.Read(buffer, sizeof(buffer));
reply.out().write(buffer, bytes_read);
total_bytes_written += bytes_read;
if (bytes_read < sizeof(buffer))
break;
}
netstorage_object.Close();
LOG_POST(Info << "retrieved data: " << total_bytes_written << " bytes");
return 0;
}
示例5: x_GetCGIContextParams
void CBlastHitMatrixCGIApplication::x_GetCGIContextParams(CCgiContext &ctx)
{
const CCgiRequest& request = ctx.GetRequest();
const TCgiEntries& entries = request.GetEntries();
m_RID = s_GetRequestParam(entries,"rid");
string paramVal = s_GetRequestParam(entries,"width");
m_Width = !paramVal.empty() ? NStr::StringToInt(paramVal) : 800;
paramVal = s_GetRequestParam(entries,"height");
m_Height = !paramVal.empty() ? NStr::StringToInt(paramVal) : 600;
//Indicates that image should output in the file
m_File = s_GetRequestParam(entries,"file");
m_Thumbnail = s_GetRequestParam(entries,"thumbnail");
}
示例6: aip
void CVACommand :: Execute(CCgiContext& ctx)
{
CCgiRequest& req = ctx.GetRequest();
CCgiResponse& resp = ctx.GetResponse();
string mst = req.GetEntry("master").GetValue();
if ( mst.empty() ) {
PrtMes::PrintErrorHeader(&resp, "VastAlign", 1);
PrtMes::PrintMsgWithTail(&resp,
"<h3>No master privided. </h3>n");
}
if ( 4 == mst.size() ) mst += ' ';
if ( 6 <= mst.size() ) {
mst[4] = mst[5];
if ( 6 == mst.size() ) mst[5] = '\0';
}
if ( 'x' == mst[4] ) mst[4] = ' ';
unsigned i;
for (i=0; i< mst.size(); i++) mst[i] = toupper(mst[i]);
string slv = req.GetEntry("slave").GetValue();
if ( slv.empty() ) {
PrtMes::PrintErrorHeader(&resp, "VastAlign", 1);
PrtMes::PrintMsgWithTail(&resp, "<h3>No slave privided. </h3>n");
}
if ( 4 == slv.size() ) slv += ' ';
if ( 6 <= slv.size() ) {
slv[4] = slv[5];
if ( 6 == slv.size()) slv[5] = '\0';
}
if ( 'x' == slv[4] ) slv[4] = ' ';
for (i=0; i< slv.size(); i++) slv[i] = toupper(slv[i]);
string value = req.GetEntry("from").GetValue();
unsigned from = 0;
if ( !value.empty() ) from = atoi(value.c_str());
value = req.GetEntry("to").GetValue();
unsigned to = 0;
if ( !value.empty() ) to = atoi(value.c_str());
VastPageDataPtr vpp = NewDataType <VastPageData> (1);
unsigned row_count =
constructTopNBestAlignedVastRows(vpp,1, (char *)mst.c_str(),
(char *)slv.c_str(), from, to, 0, 0,1);
if (!row_count) vpp[0].IpdpLen = 0;
BiostrucAnnotSetPtr pbsa = constructBASPFromVastPagePtr(vpp, 1);
{AsnIoPtr aip;
aip = AsnIoOpen("pbsa.out", "w");
BiostrucAnnotSetAsnWrite(pbsa, aip, NULL);
AsnIoClose(aip);
}
auto_ptr <CObjectOStream> oos
( CObjectOStream::Open( eSerial_AsnBinary, resp.out() ) ); //Cn3D
CObjectOStream::AsnIo aip(*oos, "Biostruc-annot-set");
// printf("Content-type: chemical/ncbi-asn1-binary\n\n"); launch Cn3D
// printf("Content-type: text/html\n\n"); for test
/*
auto_ptr <CObjectOStream> oos
( CObjectOStream::Open( eSerial_AsnText, resp.out() ) );
aip = AsnIoOpen("pbsa.out", "w");
*/
resp.SetContentType("application/octet-stream"); // Cn3D
resp.WriteHeader();
BiostrucAnnotSetAsnWrite(pbsa, aip, NULL);
aip.End();
BiostrucAnnotSetFree(pbsa);
delete [] vpp;
return;
}