Application.cfc Helper Includes - Mura Docs v6

Application.cfc Helper Includes

If your plugin requires its own Application.cfc, Mura provides helper includes that allow your plugin to stay in sync with the Mura application request lifecycle.

These files live in the {mura_root}/config/appcfc/ directory. There is one file that includes the entire method, and one file that only contains the business logic for each or the Application.cfc events that Mura interacts.

These are critically important in plugins that might be accessed outside of a normal Mura page, such as web service end-points. If your plugin is using the Mura Scope or indeed any part of Mura, you must ensure that Mura has initialized properly for these functions and services to be available. 

To accomplish this, simply include the appropriate method or include file in your plugin's own start-up events such as onApplicationLoad().

/plugin/Application.cfc

component {
/*
You must include the applicationSettings.cfm file to
share the same Application.cfc
*/
include "../../config/applicationSettings.cfm";
include "../../config/appcfc/onApplicationStart_method.cfm";
/*
There are actually 4 onRequestStart method includes:
onRequestStart_method.cfm
onRequestStart_scriptProtect_method.cfm
scriptProtect_include.cfm
onRequestStartinclude.cfm
The 'scriptProtect' versions run the request through Portcullis.cfc
In the below example it is creating its own onRequestStart function
and include the core Mura business logic.
*/
onRequestStart() {
include "../../config/appcfc/scriptProtect_include.cfm";
include "../../config/appcfc/onRequestStart_include.cfm";
}
include "../../config/appcfc/onRequestEnd_method.cfm";
include "../../config/appcfc/onSessionStart_method.cfm";
include "../../config/appcfc/onSessionEnd_method.cfm";
include "../../config/appcfc/onError_method.cfm";
include "../../config/appcfc/onMissingTemplate_method.cfm";
}