forked from existdissolve/Pink-Unicorns-Do-Exist
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathApplication.cfc
122 lines (108 loc) · 3.94 KB
/
Application.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/**
* Copyright 2005-2007 ColdBox Framework by Luis Majano and Ortus Solutions, Corp
* www.ortussolutions.com
* ---
* Application Bootstrap
*/
component {
/**
* --------------------------------------------------------------------------
* Application Properties: Modify as you see fit!
* --------------------------------------------------------------------------
*/
this.name = "Pink Unicorns Do Exist";
this.sessionManagement = true;
this.sessionTimeout = createTimespan( 0, 0, 30, 0 );
this.setClientCookies = true;
this.setDomainCookies = true;
this.scriptProtect = false;
this.secureJSON = false;
this.timezone = "UTC";
this.whiteSpaceManagement = "smart";
/**
* --------------------------------------------------------------------------
* ColdBox Bootstrap Settings
* --------------------------------------------------------------------------
* Modify only if you need to, else default them.
* https://coldbox.ortusbooks.com/getting-started/configuration/bootstrapper-application.cfc
*/
// COLDBOX STATIC PROPERTY, DO NOT CHANGE UNLESS THIS IS NOT THE ROOT OF YOUR COLDBOX APP
COLDBOX_APP_ROOT_PATH = getDirectoryFromPath( getCurrentTemplatePath() );
// The web server mapping to this application. Used for remote purposes or static purposes
COLDBOX_APP_MAPPING = "";
// COLDBOX PROPERTIES
COLDBOX_CONFIG_FILE = "";
// COLDBOX APPLICATION KEY OVERRIDE
COLDBOX_APP_KEY = "";
// By default if a reinit is issued, other requests fail and wait.
COLDBOX_FAIL_FAST = true;
/**
* --------------------------------------------------------------------------
* Location Mappings
* --------------------------------------------------------------------------
* - cbApp : Quick reference to root application
* - coldbox : Where ColdBox library is installed
*/
this.mappings[ "/CarTracker" ] = COLDBOX_APP_ROOT_PATH;
this.mappings[ "/cborm" ] = COLDBOX_APP_ROOT_PATH & "modules/cborm";
this.mappings[ "/coldbox" ] = COLDBOX_APP_ROOT_PATH & "coldbox";
/**
* --------------------------------------------------------------------------
* ORM + Datasource Settings
* --------------------------------------------------------------------------
*/
this.ormenabled = true;
this.ormsettings = {
cfclocation : "models.orm",
datasource : "CarTracker",
// Logging is on so you can see and debug any issues
logsql : true,
eventhandling : true,
// Use the ColdBox WireBox Handler for events
eventHandler : "cborm.models.EventHandler",
flushAtRequestEnd : false,
autoManageSession : false
};
// application start
public boolean function onApplicationStart(){
application.cbBootstrap = new coldbox.system.Bootstrap(
COLDBOX_CONFIG_FILE,
COLDBOX_APP_ROOT_PATH,
COLDBOX_APP_KEY,
COLDBOX_APP_MAPPING
);
application.cbBootstrap.loadColdbox();
return true;
}
// request start
public boolean function onRequestStart( String targetPage ){
// ORM REload Checks
if ( structKeyExists( URL, "ormReload" ) ) {
ormReload();
}
// Bootstrap Reinit
if ( not structKeyExists( application, "cbBootstrap" ) ) {
lock name="coldbox.bootstrap.#this.name#" type="exclusive" timeout="5" throwonTimeout=true {
structDelete( application, "cbBootStrap" );
onApplicationStart();
}
}
// Process ColdBox Request
application.cbBootstrap.onRequestStart( arguments.targetPage );
return true;
}
public void function onApplicationEnd( struct appScope ){
arguments.appScope.cbBootStrap.onApplicationEnd( argumentCollection = arguments );
}
public void function onSessionStart(){
if ( !isNull( application.cbBootstrap ) ) {
application.cbBootStrap.onSessionStart();
}
}
public void function onSessionEnd( struct sessionScope, struct appScope ){
arguments.appScope.cbBootStrap.onSessionEnd( argumentCollection = arguments );
}
public boolean function onMissingTemplate( template ){
return application.cbBootstrap.onMissingTemplate( argumentCollection = arguments );
}
}