-
Notifications
You must be signed in to change notification settings - Fork 3
/
Application_noinheritance.cfc
95 lines (83 loc) · 4.39 KB
/
Application_noinheritance.cfc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<!-----------------------------------------------------------------------
********************************************************************************
Copyright 2005-2007 ColdBox Framework by Luis Majano and Ortus Solutions, Corp
www.coldbox.org | www.luismajano.com | www.ortussolutions.com
********************************************************************************
Author : Luis Majano
Date : 10/16/2007
Description :
This is the Application.cfc for usage withing the ColdBox Framework.
Make sure that it extends the coldbox object:
coldbox.system.Coldbox
So if you have refactored your framework, make sure it extends coldbox.
----------------------------------------------------------------------->
<cfcomponent output="false">
<cfsetting enablecfoutputonly="yes">
<!--- APPLICATION CFC PROPERTIES --->
<cfset this.name = hash(getCurrentTemplatePath())>
<cfset this.sessionManagement = true>
<cfset this.sessionTimeout = createTimeSpan(0,0,30,0)>
<cfset this.setClientCookies = true>
<!--- COLDBOX STATIC PROPERTY, DO NOT CHANGE UNLESS THIS IS NOT THE ROOT OF YOUR COLDBOX APP --->
<cfset COLDBOX_APP_ROOT_PATH = getDirectoryFromPath(getCurrentTemplatePath())>
<!--- The web server mapping to this application. Used for remote purposes or static purposes --->
<cfset COLDBOX_APP_MAPPING = "">
<!--- COLDBOX PROPERTIES --->
<cfset COLDBOX_CONFIG_FILE = "">
<!--- COLDBOX APPLICATION KEY OVERRIDE --->
<cfset COLDBOX_APP_KEY = "">
<!--- on Application Start --->
<cffunction name="onApplicationStart" returnType="boolean" output="false">
<cfscript>
//Load ColdBox
application.cbBootstrap = CreateObject("component","coldbox.system.Coldbox").init(COLDBOX_CONFIG_FILE,COLDBOX_APP_ROOT_PATH,COLDBOX_APP_KEY,COLDBOX_APP_MAPPING);
application.cbBootstrap.loadColdbox();
return true;
</cfscript>
</cffunction>
<!--- on Request Start --->
<cffunction name="onRequestStart" returnType="boolean" output="true">
<!--- ************************************************************* --->
<cfargument name="targetPage" type="string" required="true" />
<!--- ************************************************************* --->
<!--- BootStrap Reinit Check --->
<cfif not structKeyExists(application,"cbBootstrap") or application.cbBootStrap.isfwReinit()>
<cflock name="coldbox.bootstrap_#hash(getCurrentTemplatePath())#" type="exclusive" timeout="5" throwontimeout="true">
<cfset structDelete(application,"cbBootStrap")>
<cfset application.cbBootstrap = CreateObject("component","coldbox.system.Coldbox").init(COLDBOX_CONFIG_FILE,COLDBOX_APP_ROOT_PATH,COLDBOX_APP_KEY,COLDBOX_APP_MAPPING)>
</cflock>
</cfif>
<!--- Reload Checks --->
<cfset application.cbBootstrap.reloadChecks()>
<!--- Process A ColdBox Request Only --->
<cfif findNoCase('index.cfm', listLast(arguments.targetPage, '/'))>
<cfset application.cbBootstrap.processColdBoxRequest()>
</cfif>
<!--- WHATEVER YOU WANT BELOW --->
<cfreturn true>
</cffunction>
<!--- on Application End --->
<cffunction name="onApplicationEnd" returnType="void" output="false">
<!--- ************************************************************* --->
<cfargument name="appScope" type="struct" required="true">
<!--- ************************************************************* --->
<cfset arguments.appScope.cbBootstrap.onApplicationEnd(argumentCollection=arguments)>
</cffunction>
<!--- on Session Start --->
<cffunction name="onSessionStart" returnType="void" output="false">
<cfset application.cbBootstrap.onSessionStart()>
</cffunction>
<!--- on Session End --->
<cffunction name="onSessionEnd" returnType="void" output="false">
<!--- ************************************************************* --->
<cfargument name="sessionScope" type="struct" required="true">
<cfargument name="appScope" type="struct" required="false">
<!--- ************************************************************* --->
<cfset appScope.cbBootstrap.onSessionEnd(argumentCollection=arguments)>
</cffunction>
<!--- OnMissing Template --->
<cffunction name="onMissingTemplate" access="public" returntype="boolean" output="true" hint="I execute when a non-existing CFM page was requested.">
<cfargument name="template" type="string" required="true" hint="I am the template that the user requested."/>
<cfreturn application.cbBootstrap.onMissingTemplate(argumentCollection=arguments)>
</cffunction>
</cfcomponent>