-
Notifications
You must be signed in to change notification settings - Fork 1
/
Application.cfc
executable file
·151 lines (138 loc) · 4.67 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/**
* 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 = "My ColdBox Application";
this.sessionManagement = true;
this.sessionTimeout = createTimespan( 0, 1, 0, 0 );
this.setClientCookies = true;
this.setDomainCookies = true;
this.scriptProtect = false;
this.secureJSON = false;
this.timezone = "UTC";
this.whiteSpaceManagement = "smart";
/**
* --------------------------------------------------------------------------
* Java Integration
* --------------------------------------------------------------------------
* Modify only if you need to, else default them: https://cfdocs.org/application-cfc
*/
this.javaSettings = {
loadPaths : [ expandPath( "./lib/java" ) ],
loadColdFusionClassPath : true,
reloadOnChange : false
};
/**
* --------------------------------------------------------------------------
* 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[ "/cbapp" ] = COLDBOX_APP_ROOT_PATH;
this.mappings[ "/coldbox" ] = COLDBOX_APP_ROOT_PATH & "coldbox";
/**
* --------------------------------------------------------------------------
* Manually load JDBC jar as an OSGI bundle
* --------------------------------------------------------------------------
*/
bundleSymbolicName = "org.sqlite.JDBC";
bundleVersion = "3.40.0";
bundlePath = ExpandPath( "/lib/java/sqlite-jdbc-3.40.0.0.jar" );
osgiLoader = new models.util.OSGILoader();
if( !osgiLoader.bundleIsLoaded( bundleSymbolicName, bundleVersion ) ){
osgiLoader.installBundle( bundlePath );
}
/**
* --------------------------------------------------------------------------
* ORM + Datasource Settings
* --------------------------------------------------------------------------
*/
this.datasource = "datatables";
this.datasources[ "datatables" ] = {
class: "org.sqlite.JDBC",
connectionString: "jdbc:sqlite:#expandPath( '/datatables.db' )#",
};
/**
* Fires when the application starts
*/
public boolean function onApplicationStart(){
setting requestTimeout ="300";
application.cbBootstrap= new coldbox.system.Bootstrap(
COLDBOX_CONFIG_FILE,
COLDBOX_APP_ROOT_PATH,
COLDBOX_APP_KEY,
COLDBOX_APP_MAPPING
);
application.cbBootstrap.loadColdbox();
return true;
}
/**
* Fires when the application ends
*
* @appScope The app scope
*/
public void function onApplicationEnd( struct appScope ){
arguments.appScope.cbBootstrap.onApplicationEnd( arguments.appScope );
}
/**
* Fires on every request
*
* @targetPage The requested page
*/
public boolean function onRequestStart( string targetPage ){
// Process ColdBox Request
application.cbBootstrap.onRequestStart( arguments.targetPage );
return true;
}
/**
* Fires on every session start
*/
public void function onSessionStart(){
if ( !isNull( application.cbBootstrap ) ) {
application.cbBootStrap.onSessionStart();
}
}
/**
* Fires on session end
*
* @sessionScope The session scope
* @appScope The app scope
*/
public void function onSessionEnd( struct sessionScope, struct appScope ){
arguments.appScope.cbBootStrap.onSessionEnd( argumentCollection = arguments );
}
/**
* On missing template handler
*
* @template
*/
public boolean function onMissingTemplate( template ){
return application.cbBootstrap.onMissingTemplate( argumentCollection = arguments );
}
}