Hi,
I am using coldfusion for years now but I am still in the old way of coding with the application.cfm and the tag version of the code .... (yeah I know, I am playing the old guy but it's from the jeremy allaire old time).
I am puting together an API REST with lucee ... and I am not able to set any application variables ... getting stuck on this is just upsetting me so bad ...
so I have an application.cfc with that kind of code :
component output="false"
{
this.name = "apirest";//RestAPI
this.applicationTimeout = createTimespan(0,2,0,0);
this.restsettings.skipCFCWithError = true;
this.nom0='bonjour0'; //debug test
variables.nom1='bonjour1'; //debug test
application.nom2='bonjour2'; //debug test
public function onApplicationStart()
{
writeLog(file="apilog", text="Lancement REST API");
this.nom0_b='bonjour0_onappstart';
variables.nom1_b='bonjour1_onappstart';
application.ipgranted = "195.258.70.167";
application.logname = "api";
application.logname_error = "api_error";
return true;
}
public function onApplicationEnd()
{
writeLog(file="apilog", text="FIN REST API");
return;
}
public boolean function onRequestStart()
{
writeLog(file="apilog", text="Request START");
return true;
}
public void function onError(e){
writeLog(file="api_error", text="#GetFunctionCalledName()# called avec #serialize(e)#");
writeDump(var=e, label="ERROR");
abort;
}
}
and I have just this in a test.cfc file :
component restpath="/test" rest="true" displayname="get test"{
remote any function get_test(numeric id restargsource="Path") httpmethod="GET" restpath="{id}" {
dump(application);
dump(variables);
dump(super);
dump(REQUEST);
return;
}
}
an if I call the test page with a GET :
http://api.distrigame.com/api/1.0/test/1(I did change REST by API in the server.xml page)
it display the variables but I see nowhere any of the variables I set !
none of them ....
whats wrong ???
Stéphane