-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApplication.cfc
125 lines (106 loc) · 4.12 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
/**
********************************************************************************
Copyright 2005-2007 ColdBox Framework by Luis Majano and Ortus Solutions, Corp
www.coldboxframework.com | www.luismajano.com | www.ortussolutions.com
********************************************************************************
*/
component{
// Application properties
this.name = hash( getCurrentTemplatePath() );
import coldbox.system.*;
COLDBOX_APP_ROOT_PATH = getDirectoryFromPath( getCurrentTemplatePath() );
COLDBOX_APP_MAPPING = "";
COLDBOX_CONFIG_FILE = "";
COLDBOX_APP_KEY = "";
this.javaSettings = { loadPaths = [ "lib" ], reloadOnChange = false };
this.mappings[ "/ram" ] = "ram://";
this.mappings[ "/testbox" ] = "/testbox";
this.mappings[ "/models" ] = "/models";
//Enable/Disable cookie/session/client variables
this.sessionManagement = true;
this.setClientCookies = true;
this.clientManagement = true;
this.setDomainCookies = true;
this.typeChecking = true;
this.bufferOutput = true;
this.compression = true;
this.suppressRemoteComponentContent = true;
this.ormEnabled = true;
this.invokeImplicitAccessor = true;
// Client / Login / Session storage locations
this.loginStorage = "Session";
this.clientStorage = "coldfusionwarsdb";
this.sessionstorage = "coldfusionwarsdb";
this.locale = "en_US";
this.timezone = "America/New_York";
this.sessionType = "cfml";
this.localMode = "classic";
this.charset.web = "UTF-8";
this.charset.resource = "UTF-8";
this.scopeCascading = "standard";
// Timeouts
this.applicationTimeout = createTimeSpan( 1, 0, 0, 0 );
this.clientTimeout = createTimeSpan(180,0,0,0);
this.sessionTimeout = createTimeSpan(0,0,90,0);
this.requestTimeout = createTimeSpan(0,0,0,50);
// Enable ORM
this.ormEnabled = true;
// ORM Datasource
this.datasource = "coldfusionwarsdb";
// ORM configuration settings
this.ormSettings = {
// Specifies database engine to use
dialect = "MySQL",
// Choose if you want ORM to create the database for you or not?
dbcreate = "update",
// Location of your entities, default is your convention model folder
cfclocation = ["models"],
// Log SQL
logSQL = true,
// Don't flush at end of requests, let Active Entity manage it for you
flushAtRequestEnd = false,
// Don't manage session, let Active Entity manage it for you
autoManageSession = false,
// Active ORM events
eventHandling = true,
//Naming Strategy
namingstrategy = "smart",
//SQL Init Script
sqlscript = "config/init.sql",
cacheprovider = "ehcache",
secondarycacheenabled = false,
// Use the ColdBox WireBox Handler for events
eventHandler = "coldbox.system.orm.hibernate.WBEventHandler"
};
// application start
public boolean function onApplicationStart(){
application.cbBootstrap = new coldbox.system.Coldbox( 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){
// Bootstrap Reinit
if( not structKeyExists(application,"cbBootstrap") or application.cbBootStrap.isfwReinit() ){
lock name="coldbox.bootstrap_#this.name#" type="exclusive" timeout="5" throwonTimeout=true{
structDelete( application, "cbBootStrap" );
componentCacheClear();
ctCacheClear();
pagePoolClear();
onApplicationStart();
}
}
// Process ColdBox Request
application.cbBootstrap.onRequestStart( arguments.targetPage );
return true;
}
public void function onSessionStart(){
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 );
}
}