-
Notifications
You must be signed in to change notification settings - Fork 0
/
Application.cfc
87 lines (66 loc) · 2.73 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
<cfcomponent displayname="Application" output="false">
<cfset this.name="swisspostalapp">
<cfset this.Datasource = "swisspostal">
<cfset this.applicationTimeout = createTimeSpan(0,20,0,0)>
<cfset this.sessionmanagement = false>
<cfset this.SetClientCookies = false>
<cfset this.rootDir = getDirectoryFromPath(getCurrentTemplatePath()) />
<cfset this.mappings[ "/framework" ] = "#this.rootDir#framework" />
<cfset this.mappings[ "/app" ] = "#this.rootDir#" />
<cfsetting requesttimeout = "1200">
<cfset this.cache.connections["default"] = {
class: 'lucee.runtime.cache.ram.RamCache'
, storage: false
, custom: {
"timeToIdleSeconds":"0",
"timeToLiveSeconds":"0"
}
, default: 'object'
}>
<cffunction name="_get_framework_one" returntype="any" output="false">
<cfif NOT structKeyExists( request, '_framework_one' )>
<cfset request._framework_one = new MyApplication({
trace: false,
reload = 'reload',
decodeRequestBody = true,
missingview = 'main.missingview',
generateSES = true,
SESOmitIndex = true,
reloadApplicationOnEveryRequest = true,
subsystemdelimiter = ":",
preflightOptions = true,
routes:[
{"$GET/api/products/{id:[0-9]+}" = "products/get/id/:id"},
{"$POST/api/products/{id:[0-9]+}" = "products/update/id/:id"},
{"$POST/api/products/" = "products/new"},
{"$POST/api/inventory/{id:[0-9]+}" = "products/updateInventory/id/:id"}
],
routesCaseSensitive = false
})>
</cfif>
<cfreturn request._framework_one>
</cffunction>
<cffunction name="OnRequestStart" access="public" output="false">
<cfargument name="TargetPage" type="string" required="true"/>
<cfset _get_framework_one().onRequestStart( TargetPage )>
<cfreturn true>
</cffunction>
<cffunction name="OnApplicationStart" access="public" output="false">
<cfreturn _get_framework_one().onApplicationStart()>
</cffunction>
<cffunction name="onSessionStart" access="public" output="false">
<cfset _get_framework_one().onSessionStart()>
</cffunction>
<cffunction name="onRequest" access="public" output="true">
<cfargument name="targetPage" type="string" required="true">
<cfset _get_framework_one().onRequest( targetPage )>
</cffunction>
<cffunction name="onRequestEnd">
<cfreturn _get_framework_one().onRequestEnd( )>
</cffunction>
<cffunction name="onError">
<cfargument name="exception">
<cfargument name="event">
<cfreturn _get_framework_one().onError( exception, event )>
</cffunction>
</cfcomponent>