Adam,
I have updated the path to my CustomRepresentationClass.cfc. I am certain the path is correct and I'm still having the same issue. I get XML data back unless I comment out the call to the setDefaultRepresentationClass method.
Here is my Application.cfc:
<cfcomponent extends="taffy.core.api">
<cfscript>
function applicationStartEvent(){
application.dsn = 'outreach';
application.JsonUtil = createObject("component", "api.v1.resources.JSONUtil.JSONUtil");
application.AnythingToXML = createObject("component", "api.v1.resources.AnythingToXML.AnythingToXML");
}
function configureTaffy(){
setDefaultRepresentationClass("api.v1.resources.CustomRepresentationClass");
}
</cfscript>
</cfcomponent>
Here is my CustomRepresentationClass.cfc:
<cfcomponent extends="taffy.core.baseRepresentation">
<cfset variables.jsonUtil = application.jsonUtil />
<cfset variables.AnythingToXML = application.AnythingToXML />
<cffunction name="getAsJSON" taffy:mime="application/json" taffy:default="true" output="false">
<cfreturn variables.jsonUtil.serializeJson(variables.data) />
</cffunction>
<cffunction name="getAsXML" taffy:mime="application/xml" output="false">
<cfreturn variables.AnythingToXML.ToXML(variables.data) />
</cffunction>
</cfcomponent>
My configsCollection.cfc resource:
<cfcomponent extends="taffy.core.resource" taffy:uri="/configs" hint="sends application configs">
<cffunction name="get" access="public" output="true">
<cfquery name="q" datasource="#application.dsn#">
select * from WAR_config
</cfquery>
<cfif q.recordCount gt 0>
<cfreturn representationOf(q).withStatus(200) />
<cfelse>
<cfreturn noData().withStatus(404) />
</cfif>
</cffunction>
</cfcomponent>
Thanks,
James