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