text
stringlengths
0
2.2M
logger << ("Rest: skipping param " + param.type + ", from is body and method is " + restfunction.meth) << std::endl;
}
else if(!(SerializeBase::isPrimitiveDataType(ttype) || ttype=="filestream" || ttype=="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!="" && url.find("*")==std::string::npos)
{
if(url=="")
url = "/" + clas;
else if(url.at(0)!='/')
url = "/" + url;
std::string urlmpp;
if(restfunction.path!="")
{
urlmpp = "/"+appName+url+"/"+restfunction.path;
RegexUtil::replace(urlmpp,"[/]+","/");
StringUtil::trim(urlmpp);
if(urlmpp.at(urlmpp.length()-1)=='/') {
urlmpp = urlmpp.substr(0, urlmpp.length()-1);
}
restfunction.path = urlmpp;
ConfigurationData::getInstance()->rstCntMap[appName][restfunction.meth+urlmpp].push_back(restfunction);
}
else
{
urlmpp = "/"+appName+url+"/"+restfunction.name;
RegexUtil::replace(urlmpp,"[/]+","/");
StringUtil::trim(urlmpp);
if(urlmpp.at(urlmpp.length()-1)=='/') {
urlmpp = urlmpp.substr(0, urlmpp.length()-1);
}
restfunction.path = urlmpp;
ConfigurationData::getInstance()->rstCntMap[appName][restfunction.meth+urlmpp].push_back(restfunction);
}
Bean bean(clas,"",clas,scope,false,true,appName);
ConfigurationData::getInstance()->ffeadContext.addBean(bean);
if(!isClasSecure && cs.pubms.at(var).markers.find("@Secure")!=cs.pubms.at(var).markers.end())
{
int totl = cs.pubms.at(var).markers["@Secure"].size();
SecureAspect aspect;
aspect.role = cs.pubms.at(var).markers["@Secure"].at(totl-1).getAttributeValue("role");
bool valid = true;
if(StringUtil::trimCopy(aspect.role)=="")
{
logger << ("No role defined for Secure path, skipping...") << std::endl;
valid = false;
}
aspect.path = urlmpp;
normalizeUrl(appName, aspect.path);
std::string provName = cs.pubms.at(var).markers["@Secure"].at(totl-1).getAttributeValue("providerName");
if(StringUtil::trimCopy(provName)=="")
{
logger << ("No providerName defined for Secure path, skipping...") << std::endl;
valid = false;
}
if(cs.pubms.at(var).markers["@Secure"].size()>1)
{
logger << ("Found more than one @Secure marker, only the last defined marker will be considered, ignoring others..") << std::endl;
}
if(valid && ConfigurationData::getInstance()->securityObjectMap[appName].find(provName)
!=ConfigurationData::getInstance()->securityObjectMap[appName].end())
{
Security securityObject = ConfigurationData::getInstance()->securityObjectMap[appName][provName];
if(securityObject.addAspect(aspect))
{
ConfigurationData::getInstance()->securityObjectMap[appName][provName] = securityObject;
logger << ("Security: Adding Secure Path => " + aspect.path + " , role => " + aspect.role) << std::endl;
}
}
else if(valid)
{
logger << ("Security Provider " + provName + " not found, skipping...") << std::endl;
}
}
logger << ("Rest: Adding rest-controller => " + urlmpp + " , class => " + clas) << std::endl;