Skip to content

Commit

Permalink
Resolves #111: Change from "defaultRepresentationClass" to just "repr…
Browse files Browse the repository at this point in the history
…esentationClass"
  • Loading branch information
Adam Tuttle committed Nov 8, 2012
1 parent 91bcd3c commit 7392726
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions core/api.cfc
Expand Up @@ -282,7 +282,7 @@
<cfset local.defaultConfig.reloadKey = "reload" />
<cfset local.defaultConfig.reloadPassword = "true" />
<cfset local.defaultConfig.reloadOnEveryRequest = false />
<cfset local.defaultConfig.defaultRepresentationClass = "taffy.core.nativeJsonRepresentation" />
<cfset local.defaultConfig.representationClass = "taffy.core.nativeJsonRepresentation" />
<cfset local.defaultConfig.dashboardKey = "dashboard" />
<cfset local.defaultConfig.disableDashboard = false />
<cfset local.defaultConfig.unhandledPaths = "/flex2gateway" />
Expand Down Expand Up @@ -339,7 +339,7 @@
<cfset throwError(500, "You must either set an external bean factory or use the internal factory by creating a `/resources` folder.") />
</cfif>
<!--- automatically introspect mime types from cfc metadata of default representation class --->
<cfset inspectMimeTypes(application._taffy.settings.defaultRepresentationClass) />
<cfset inspectMimeTypes(application._taffy.settings.representationClass) />
<!--- check to make sure a default mime type is set --->
<cfif application._taffy.settings.defaultMime eq "">
<cfset throwError(400, "You have not specified a default mime type!") />
Expand Down Expand Up @@ -923,11 +923,11 @@

<cffunction name="setDefaultRepresentationClass" access="public" output="false" returnType="void" hint="Override the global default representation object with a custom class">
<cfargument name="customClassDotPath" type="string" required="true" hint="Dot-notation path to your custom class to use as the default" />
<cfset application._taffy.settings.defaultRepresentationClass = arguments.customClassDotPath />
<cfset application._taffy.settings.representationClass = arguments.customClassDotPath />
</cffunction>

<cffunction name="newRepresentation" access="public" output="false">
<cfargument name="class" type="string" default="#application._taffy.settings.defaultRepresentationClass#" />
<cfargument name="class" type="string" default="#application._taffy.settings.representationClass#" />
<cfif application._taffy.factory.containsBean(arguments.class)>
<cfreturn application._taffy.factory.getBean(arguments.class) />
<cfelse>
Expand Down
4 changes: 2 additions & 2 deletions core/resource.cfc
Expand Up @@ -8,7 +8,7 @@
</cffunction>

<cffunction name="noData" access="private" output="false" hint="use this function to return only headers to the consumer, no data">
<cfreturn createObject("component", application._taffy.settings.defaultRepresentationClass).noData() />
<cfreturn createObject("component", application._taffy.settings.representationClass).noData() />
</cffunction>

<cffunction name="streamFile" access="private" output="false" hint="Use this function to specify a file name (eg c:\tmp\kitten.jpg) to be streamed to the client. When you use this method it is *required* that you also use .withMime() to specify the mime type.">
Expand Down Expand Up @@ -39,7 +39,7 @@
<cfargument name="repClass" type="string" />
<cfif repClass eq "">
<!--- recursion not the most efficient path here, but it's damn readable --->
<cfreturn getRepInstance(application._taffy.settings.defaultRepresentationClass) />
<cfreturn getRepInstance(application._taffy.settings.representationClass) />
<cfelseif application._taffy.factory.containsBean(arguments.repClass)>
<cfreturn application._taffy.factory.getBean(arguments.repClass) />
<cfelse>
Expand Down
2 changes: 1 addition & 1 deletion examples/api/Application.cfc
Expand Up @@ -7,7 +7,7 @@
variables.framework.debugKey = "debug";
variables.framework.reloadKey = "reload";
variables.framework.reloadPassword = "true";
variables.framework.defaultRepresentationClass = "taffy.core.genericRepresentation";
variables.framework.representationClass = "taffy.core.genericRepresentation";
variables.framework.returnExceptionsAsJson = true;

// do your onApplicationStart stuff here
Expand Down
2 changes: 1 addition & 1 deletion examples/api_anythingtoxml/Application.cfc
Expand Up @@ -4,7 +4,7 @@
this.name = hash(getCurrentTemplatePath());

variables.framework = {};
variables.framework.defaultRepresentationClass = "taffy.bonus.AnythingToXmlRepresentation";
variables.framework.representationClass = "taffy.bonus.AnythingToXmlRepresentation";

function applicationStartEvent(){
application.anythingToXml = createObject("component", "anythingtoxml.AnythingToXML").init();
Expand Down
2 changes: 1 addition & 1 deletion examples/api_coldspring/Application.cfc
Expand Up @@ -7,7 +7,7 @@
variables.framework.debugKey = "debug";
variables.framework.reloadKey = "reload";
variables.framework.reloadPassword = "true";
variables.framework.defaultRepresentationClass = "taffy.core.nativeJsonRepresentation";
variables.framework.representationClass = "taffy.core.nativeJsonRepresentation";

//do your onApplicationStart stuff here
function applicationStartEvent(){
Expand Down
4 changes: 2 additions & 2 deletions examples/api_configVar/Application.cfc
Expand Up @@ -8,7 +8,7 @@
variables.framework.debugKey = "debug";
variables.framework.reloadKey = "reload";
variables.framework.reloadPassword = "true";
variables.framework.defaultRepresentationClass = "taffy.core.nativeJsonRepresentation";
variables.framework.representationClass = "taffy.core.nativeJsonRepresentation";
variables.framework.dashboardKey = "dashboard";
variables.framework.disableDashboard = false;
variables.framework.unhandledPaths = "/flex2gateway";
Expand All @@ -24,7 +24,7 @@
debugKey = "debug",
reloadKey = "reload",
reloadPassword = "true",
defaultRepresentationClass = "taffy.core.nativeJsonRepresentation",
representationClass = "taffy.core.nativeJsonRepresentation",
dashboardKey = "dashboard",
disableDashboard = false,
unhandledPaths = "/flex2gateway",
Expand Down
2 changes: 1 addition & 1 deletion examples/api_img/Application.cfc
Expand Up @@ -7,7 +7,7 @@
variables.framework.debugKey = "debug";
variables.framework.reloadKey = "reload";
variables.framework.reloadPassword = "true";
variables.framework.defaultRepresentationClass = "taffy.core.nativeJsonRepresentation";
variables.framework.representationClass = "taffy.core.nativeJsonRepresentation";

// do your onApplicationStart stuff here
function applicationStartEvent(){
Expand Down
2 changes: 1 addition & 1 deletion examples/api_jsonutil/Application.cfc
Expand Up @@ -4,7 +4,7 @@
this.name = hash(getCurrentTemplatePath());

variables.framework = {};
variables.framework.defaultRepresentationClass = "JsonUtilRepresentation";
variables.framework.representationClass = "JsonUtilRepresentation";

</cfscript>
</cfcomponent>
2 changes: 1 addition & 1 deletion examples/api_twoFormats/Application.cfc
Expand Up @@ -4,7 +4,7 @@
this.name = hash(getCurrentTemplatePath());

variables.framework = {};
variables.framework.defaultRepresentationClass = "resources.CustomRepresentationClass";
variables.framework.representationClass = "resources.CustomRepresentationClass";

function applicationStartEvent(){
application.JsonUtil = createObject("component", "resources.JSONUtil.JSONUtil");
Expand Down
2 changes: 1 addition & 1 deletion examples/coldspring_aop/Application.cfc
Expand Up @@ -10,7 +10,7 @@
variables.framework.debugKey = "debug";
variables.framework.reloadKey = "reload";
variables.framework.reloadPassword = "true";
variables.framework.defaultRepresentationClass = "taffy.core.genericRepresentation";
variables.framework.representationClass = "taffy.core.genericRepresentation";

// do your onApplicationStart stuff here
function applicationStartEvent(){
Expand Down
2 changes: 1 addition & 1 deletion tests/Application.cfc
Expand Up @@ -6,7 +6,7 @@
variables.framework.disableDashboard = false;
variables.framework.reloadKey = "reload";
variables.framework.unhandledPaths = "/Taffy/tests/someFolder,/Taffy/tests/tests,/tests/someFolder,/tests/tests";
variables.framework.defaultRepresentationClass = "customJsonRepresentation";
variables.framework.representationClass = "customJsonRepresentation";
variables.framework.globalHeaders = {};
variables.framework.globalHeaders["x-foo-globalheader"] = "snafu";

Expand Down

0 comments on commit 7392726

Please sign in to comment.