Skip to content

Instantly share code, notes, and snippets.

@awmichel
Created September 16, 2011 15:51
Show Gist options
  • Save awmichel/1222413 to your computer and use it in GitHub Desktop.
Save awmichel/1222413 to your computer and use it in GitHub Desktop.
App.cfc Reference (Because there aren't enough yet...)
<cfcomponent output="false">
<!--- Application name, should be unique --->
<cfset this.name = "ApplicationName">
<!--- How long application vars persist --->
<cfset this.applicationTimeout = createTimeSpan(0,2,0,0)>
<!--- Should client vars be enabled? --->
<cfset this.clientManagement = false>
<!--- Where should we store them, if enable? --->
<cfset this.clientStorage = "registry">
<!--- Where should cflogin stuff persist --->
<cfset this.loginStorage = "session">
<!--- Should we even use sessions? --->
<cfset this.sessionManagement = true>
<!--- How long do session vars persist? --->
<cfset this.sessionTimeout = createTimeSpan(0,0,20,0)>
<!--- Should we set cookies on the browser? --->
<cfset this.setClientCookies = true>
<!--- should cookies be domain specific, ie, *.foo.com or www.foo.com --->
<cfset this.setDomainCookies = false>
<!--- should we try to block 'bad' input from users --->
<cfset this.scriptProtect = false>
<!--- should we secure our JSON calls? --->
<cfset this.secureJSON = false>
<!--- Should we use a prefix in front of JSON strings? --->
<cfset this.secureJSONPrefix = "">
<!--- Used to help CF work with missing files and dir indexes --->
<cfset this.welcomeFileList = "">
<!--- define custom coldfusion mappings. Keys are mapping names, values are full paths --->
<cfset this.mappings = structNew()>
<!--- define a list of custom tag paths. --->
<cfset this.customtagpaths = "">
<!--- Run when application starts up --->
<cffunction name="onApplicationStart" returnType="boolean" output="false">
<cfreturn true>
</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">
</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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment