mardi 1 avril 2014

Coldfusion onCFCRequest Changing Return Type


Vote count:

0




My customer base is finally off Coldfusion 8 so now I can take advantage of Coldfusion 9's Application.cfc -> onCFCRequest event. I have a test scenario setup and my result is not what I'm expecting. I have a method that I call which produces a valid XML response like so...



Response Header: Content-Type:application/xml;charset=UTF-8
Response:
<?xml version="1.0" encoding="UTF-8"?>
<rows><row id="10000282742505"><cell/><cell> ...


Now after I introduce the onCFCRequest event I get this back (which breaks my grids)...



Response Header: Content-Type:application/xml;charset=UTF-8
Response:
<wddxPacket version='1.0'><header/><data><string>&lt;rows&gt;&lt;row id="10000282742505"&gt;&lt;cell&gt;&lt;/cell&gt;&lt;cell&gt; ...


Here is the event...



<cffunction name="onCFCRequest" access="public" returntype="Any" output="true">
<cfargument type="string" name="cfc" required="true">
<cfargument type="string" name="method" required="true">
<cfargument type="struct" name="args" required="true">

<cfscript>
// OnCFCRequest security hole fix as detailed here: http://ift.tt/1fol4Zy
var o = createObject(ARGUMENTS.cfc);
var metadata = getMetadata(o[ARGUMENTS.method]);

if (structKeyExists(metadata, "access") && metadata.access == "remote"){
return invoke(o, ARGUMENTS.method, ARGUMENTS.args);
}else{
throw(type="InvalidMethodException", message="Invalid method called", detail="The method #method# does not exists or is inaccessible remotely");
}
</cfscript>
<cfreturn />
</cffunction>


How do I keep my remote function returning the same thing they previously did?


I am aware of this article: http://ift.tt/1fol77F


I will probably end up doing that but first I'd like to figure out why I can't simply pass through the response in the same format.



asked 20 secs ago

Gordon

1,461





Aucun commentaire:

Enregistrer un commentaire