text
stringlengths
0
2.2M
param.from = resfuncparams.at(cntn2).getAttribute("from");
param.name = resfuncparams.at(cntn2).getAttribute("name");
param.defValue = resfuncparams.at(cntn2).getAttribute("defValue");
if(param.from=="body")
{
hasBodyParam = true;
}
if(StringUtil::trimCopy(param.type)=="")
{
invalidParam = true;
logger << "Rest: no type specified for param" << std::endl;
}
else if((param.type=="filestream" || param.type=="vector-of-filestream") && param.from!="multipart-content")
{
}
else if(param.type=="vector-of-filestream" && param.from=="multipart-content"
&& StringUtil::trimCopy(param.name)=="")
{
}
else if(param.from!="body" && StringUtil::trimCopy(param.name)=="")
{
invalidParam = true;
logger << "Rest: no name specified for param" << std::endl;
}
else if(param.from=="body" && (restfunction.meth=="GET" || restfunction.meth=="OPTIONS" || restfunction.meth=="TRACE"
|| restfunction.meth=="HEAD"))
{
invalidParam = true;
logger << ("Rest: skipping param " + param.type + ", from is body and method is " + restfunction.meth) << std::endl;
}
else if(!(param.type=="int" || param.type=="short" || param.type=="long" || param.type=="float" || param.type=="string"
|| param.type=="long long" || param.type=="std::string" || param.type=="double" || param.type=="bool"
|| param.type=="filestream" || param.type=="vector-of-filestream") && param.from!="body")
{
invalidParam = true;
logger << ("Rest: skipping param " + param.type + ", from is not body and input is a complex type") << std::endl;
}
else if(param.from=="postparam" && (restfunction.meth=="GET" || restfunction.meth=="OPTIONS" || restfunction.meth=="TRACE"
|| restfunction.meth=="HEAD"))
{
invalidParam = true;
logger << ("Rest: skipping param " + param.type + ", from is postparam and method is " + restfunction.meth) << std::endl;
}
if(!invalidParam)
{
restfunction.params.push_back(param);
}
}
}
if(hasBodyParam && restfunction.params.size()>1)
{
logger << ("Rest: skipping method " + restfunction.meth + " as only one argument allowed of type body") << std::endl;
continue;
}
if(invalidParam)
{
continue;
}
if(clas!="")
{
if(url.find("*")==std::string::npos)
{
if(url=="")
url = "/" + clas;
else if(url.at(0)!='/')
url = "/" + url;
std::string urlmpp;
if(restfunction.path!="")
{
urlmpp = "/"+name+url+"/"+restfunction.path;
RegexUtil::replace(urlmpp,"[/]+","/");
restfunction.path = urlmpp;
ConfigurationData::getInstance()->rstCntMap[name][restfunction.meth+urlmpp].push_back(restfunction);
}
else
{
urlmpp = "/"+name+url+"/"+restfunction.name;
RegexUtil::replace(urlmpp,"[/]+","/");
restfunction.path = urlmpp;
ConfigurationData::getInstance()->rstCntMap[name][restfunction.meth+urlmpp].push_back(restfunction);
}
if(clas!="")
{
Bean bean(clas,"",clas,scope,false,true,name);
ConfigurationData::getInstance()->ffeadContext.addBean(bean);
}
logger << ("Rest: Adding rest-controller => " + urlmpp + " , class => " + clas) << std::endl;
}
}
}
}
}
}
}
else if(eles.at(apps).getTagName()=="security")
{
ElementList allprovs = eles.at(apps).getChildElements();
for (unsigned int cntpra = 0; cntpra < allprovs.size(); cntpra++)