Skip to content

Instantly share code, notes, and snippets.

@MJDDesign
Last active Aug 29, 2015
Embed
What would you like to do?
<!---
--- Application
--- -----------
---
--- author: Matthew
--- date: 5/4/14
--->
<cfcomponent displayname="Application" output="true" hint="Handle the application.">
<cfset THIS.Name = "AppCFC" />
<cfset THIS.ApplicationTimeout = CreateTimeSpan( 0, 0, 1, 0 ) />
<cfset THIS.SessionManagement = true />
<cfset THIS.SetClientCookies = false />
<cffunction name="OnApplicationStart" access="public" returntype="boolean" output="false" hint="">
<cfset application.url ="http://url.domain.com">
<cfset application.datasource ="datasource">
<cfset application.smtp ="emailserver.domain.com">
<cfreturn true />
</cffunction>
<cffunction name="OnSessionStart" access="public" returntype="void" output="false" hint="">
<cfset session.variable = "string">
<cfreturn />
</cffunction>
<cffunction name="OnRequestStart" access="public" returntype="boolean" output="false" hint="">
<cfargument name="TargetPage" type="string" required="true"/>
<cfreturn true />
</cffunction>
<cffunction name="OnRequest" access="public" returntype="void" output="true" hint="">
<cfargument name="TargetPage" type="string" required="true"/>
<cfinclude template="#ARGUMENTS.TargetPage#" />
<cfreturn />
</cffunction>
<cffunction name="OnRequestEnd" access="public" returntype="void" output="true" hint="">
<cfreturn />
</cffunction>
<cffunction name="OnSessionEnd" access="public" returntype="void" output="false" hint="">
<cfargument name="SessionScope" type="struct" required="true"/>
<cfargument name="ApplicationScope" type="struct" required="false" default="#StructNew()#"/>
<cfreturn />
</cffunction>
<cffunction name="OnApplicationEnd" access="public" returntype="void" output="false" hint="">
<cfargument name="ApplicationScope" type="struct" required="false" default="#StructNew()#"/>
<cfreturn />
</cffunction>
<cffunction name="OnError" access="public" returntype="void" output="true" hint="">
<cfargument name="Exception" type="any" required="true"/>
<cfargument name="EventName" type="string" required="false" default=""/>
<cfmail to="toemail@mjddesignconcepts.com" from="fromemail@mjddesignconcepts.com" subject="[ERROR]" type="html">
<cfdump var="#EventName#">
<cfdump var="#Exception#">
</cfmail>
<cfreturn />
</cffunction>
</cfcomponent>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment