Here is the code:
<cfcomponent output="false">
<cfscript>
//the application name (should be unique)
THIS.name = "ProvisionKit_15";
//how long the application variables persist
THIS.applicationTimeout = createTimeSpan(0,2,0,0);
//define whether client variables are enabled
THIS.clientManagement = false;
//where should we store them, if enabled?
THIS.clientStorage = "cookie"; //cookie||registry||datasource
//define where cflogin information should persist
THIS.loginStorage = "session"; //cookie||session
//define whether session variables are enabled
THIS.sessionManagement = true;
//how long the session variables persist?
THIS.sessionTimeout = createTimeSpan(0,0,20,0);
//define whether to set cookies on the browser?
THIS.setClientCookies = true;
//should cookies be domain specific
//i.e. *.domain.com or www.domain.com
THIS.setDomainCookies = false;
//should we try to block cross-site scripting?
THIS.scriptProtect = false;
//should we secure our JSON calls?
THIS.secureJSON = false;
//use a prefix in front of JSON strings?
THIS.secureJSONPrefix = "";
//used to help ColdFusion work with missing files
//and directory indexes. tells ColdFusion not to call
//onMissingTemplate method.
THIS.welcomeFileList = "";
//define custom coldfusion mappings.
//Keys are mapping names, values are full paths
THIS.mappings = structNew();
//define a list of custom tag paths.
THIS.customtagpaths = "";
</cfscript>
<!--- Run when application starts up --->
<cffunction name="onApplicationStart">
<cfreturn true />
<cfscript>
APPLICATION.homePage = "/index.cfm";
// billing status
APPLICATION.billingStatus.free = 100;
APPLICATION.billingStatus.current = 101;
APPLICATION.billingStatus.paymentDue = 102;
APPLICATION.billingStatus.past30 = 103;
APPLICATION.billingStatus.past60 = 104;
APPLICATION.assetType.TEXT = 1;
APPLICATION.assetType.IMAGE = 2;
APPLICATION.assetType.VIDEO = 3;
APPLICATION.assetType.SKIN = 4;
APPLICATION.assetLocale.LIBRARY = 1;
APPLICATION.assetLocale.TEMPORARY = 2;
APPLICATION.libraryType.USER = 1;
APPLICATION.libraryType.COMPANY = 2;
APPLICATION.code.SUCCESS = 100;
APPLICATION.code.FAIL = 101;
</cfscript>
</cffunction>
<!--- Run when application stops --->
<cffunction name="onApplicationEnd" returnType="void" output="false">
<cfargument name="applicationScope" required="true" />
</cffunction>
<!--- Fired when user requests a CFM that doesn't exist. --->
<cffunction name="onMissingTemplate" returnType="boolean" output="false">
<cfargument name="targetpage" required="true" type="string" />
<cfreturn true />
</cffunction>
<!--- Run before the request is processed --->
<cffunction name="onRequestStart" returnType="boolean" output="false">
<cfargument name="thePage" type="string" required="true" />
<cfreturn true />
</cffunction>
<!--- Runs before request as well, after onRequestStart --->
<cffunction name="onRequest" returnType="void">
<cfargument name="thePage" type="string" required="true" />
<cfinclude template="#ARGUMENTS.thePage#" />
</cffunction>
<!--- Runs at end of request --->
<cffunction name="onRequestEnd" returnType="void" output="false">
<cfargument name="thePage" type="string" required="true" />
</cffunction>
<!--- Runs on error --->
<cffunction name="onError" returnType="void" output="false">
<cfargument name="exception" required="true" />
<cfargument name="eventname" type="string" required="true" />
<cfdump var="#ARGUMENTS#" />
<cfabort />
</cffunction>
<!--- Runs when your session starts --->
<cffunction name="onSessionStart" returnType="void" output="false">
<cfscript>
// this will allow us to call any objects function without instantiating it
APPLICATION.user = createObject( "component", "apps.com.User" );
APPLICATION.company = createObject( "component", "apps.com.Company" );
APPLICATION.presentation = createObject( "component", "apps.com.Presentation" );
APPLICATION.library = createObject( "component", "apps.com.Library" );
// get/set list of all companies
APPLICATION.companyNodes = APPLICATION.company.getCompanyNodes();
</cfscript>
</cffunction>
<!--- Runs when session ends --->
<cffunction name="onSessionEnd" returnType="void" output="false">
<cfargument name="sessionScope" type="struct" required="true" />
<cfargument name="appScope" type="struct" required="false" />
</cffunction>
</cfcomponent>
As far as I understand it, an Application.cfc should take precedence over an Application.cfm, if present, correct? There's nothing that I need to do to make sure that the .CFC runs?
<!--- Run when application starts up --->
<cffunction name="onApplicationStart">
<cfreturn true />
You are exiting the method before anything can execute. Remove the cfreturn or move it to the end of the function. Other than a few missing quotes (perhaps a forum problem), it works fine.
Those application variables should be declared in onApplicationStart too. Otherwise, you are recreating the shared components every time a new user session starts.
Message was edited by: -==cfSearching==-