| 1 | <cftry><cfsilent> |
|---|
| 2 | <!--- |
|---|
| 3 | Copyright 2006-2007 TeraTech, Inc. http://teratech.com/ |
|---|
| 4 | |
|---|
| 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
|---|
| 6 | you may not use this file except in compliance with the License. |
|---|
| 7 | You may obtain a copy of the License at |
|---|
| 8 | |
|---|
| 9 | http://www.apache.org/licenses/LICENSE-2.0 |
|---|
| 10 | |
|---|
| 11 | Unless required by applicable law or agreed to in writing, software |
|---|
| 12 | distributed under the License is distributed on an "AS IS" BASIS, |
|---|
| 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|---|
| 14 | See the License for the specific language governing permissions and |
|---|
| 15 | limitations under the License. |
|---|
| 16 | ---> |
|---|
| 17 | |
|---|
| 18 | <!--- FB5: allow "" default - FB41 required this variable: ---> |
|---|
| 19 | <cfparam name="variables.FUSEBOX_APPLICATION_PATH" default="" /> |
|---|
| 20 | <!--- FB5: application key - FB41 always uses 'fusebox': ---> |
|---|
| 21 | <cfparam name="variables.FUSEBOX_APPLICATION_KEY" default="fusebox" /> |
|---|
| 22 | <!--- FB51: allow application to be included from other directories: ---> |
|---|
| 23 | <cfparam name="variables.FUSEBOX_CALLER_PATH" default="#replace(getDirectoryFromPath(getBaseTemplatePath()),"\","/","all")#" /> |
|---|
| 24 | <!--- FB55: easy way to override fusebox.xml parameters programmatically: ---> |
|---|
| 25 | <cfparam name="variables.FUSEBOX_PARAMETERS" default="#structNew()#" /> |
|---|
| 26 | <!--- fake the application lifecycle for old-school non-Application.cfc applications ---> |
|---|
| 27 | <cfset __fuseboxAppCfc = createObject("component","Application").bleed(variables) /> |
|---|
| 28 | <cfloop item="__v" collection="#variables#"> |
|---|
| 29 | <cfset __fuseboxAppCfc.override(__v,variables[__v]) /> |
|---|
| 30 | </cfloop> |
|---|
| 31 | <cfif isDefined("this")> |
|---|
| 32 | <cfloop item="__v" collection="#this#"> |
|---|
| 33 | <!--- not safe to allow functions to be overridden ---> |
|---|
| 34 | <cfif not isCustomFunction(this[__v])> |
|---|
| 35 | <cfset __fuseboxAppCfc.override(__v,this[__v],true) /> |
|---|
| 36 | </cfif> |
|---|
| 37 | </cfloop> |
|---|
| 38 | </cfif> |
|---|
| 39 | <cfif not structKeyExists(application,FUSEBOX_APPLICATION_KEY)> |
|---|
| 40 | <cflock name="#application.ApplicationName#_fusebox_#FUSEBOX_APPLICATION_KEY#" type="exclusive" timeout="300"> |
|---|
| 41 | <cfif not structKeyExists(application,FUSEBOX_APPLICATION_KEY)> |
|---|
| 42 | <cfset __fuseboxAppCfc.onApplicationStart() /> |
|---|
| 43 | </cfif> |
|---|
| 44 | </cflock> |
|---|
| 45 | </cfif> |
|---|
| 46 | <cfset __fuseboxAppCfc.onRequestStart(CGI.SCRIPT_NAME) /> |
|---|
| 47 | </cfsilent> |
|---|
| 48 | <cfcatch type="any"> |
|---|
| 49 | <cfif isDefined("__fuseboxAppCfc")> |
|---|
| 50 | <cfset __fuseboxAppCfc.onError(cfcatch)> |
|---|
| 51 | <cfelse> |
|---|
| 52 | <cfrethrow /> |
|---|
| 53 | </cfif> |
|---|
| 54 | </cfcatch> |
|---|
| 55 | </cftry><cfprocessingdirective suppresswhitespace="true"> |
|---|
| 56 | <cftry> |
|---|
| 57 | <cfset __fuseboxAppCfc.onRequest(CGI.SCRIPT_NAME) /> |
|---|
| 58 | <cfset __fuseboxAppCfc.onRequestEnd(CGI.SCRIPT_NAME) /> |
|---|
| 59 | <cfcatch type="any"> |
|---|
| 60 | <cfset __fuseboxAppCfc.onError(cfcatch)> |
|---|
| 61 | </cfcatch> |
|---|
| 62 | </cftry> |
|---|
| 63 | </cfprocessingdirective> |
|---|