Application.cfc
Defines application level variables and event handlers (functions invoked at various application lifecycle events).
component { this.name="myApp"; }
Application.cfc
this.name string
this.loginStorage string
Default: cookie
cookie
cookiesession
this.clientManagement boolean
Default: false
false
truefalse
this.clientStorage string
Default: registry
registry
cookieregistrydatasource_name
this.setClientCookies boolean
Default: true
true
truefalse
this.sessionManagement boolean
Default: false
false
truefalse
this.sessionTimeout numeric
this.applicationTimeout numeric
this.setDomainCookies boolean
Default: false
false
truefalse
this.scriptProtect string
noneallformurlcookiecgiform,urlform,url,cookieform,url,cookie,cgi
this.secureJSONPrefix string
this.secureJSON boolean
truefalse
this.customTagPaths string
this.mappings struct
this.welcomeFileList string
this.serverSideFormValidation boolean
this.googleMapKey string
this.datasource string
this.s3 struct
this.ormEnabled boolean
Default: false
false
this.ormSettings struct
this.smtpServerSettings struct
this.timeout numeric
this.debuggingIPAddresses string
this.enableRobustException boolean
this.enableNullSupport boolean
Default: false
false
truefalse
this.sessioncookie.httpOnly boolean
Default: true
true
this.sessioncookie.secure boolean
Default: false
false
this.sessioncookie.domain string
Default: false
false
this.sessioncookie.timeout string
Default: 30 years
30 years
this.sessioncookie.disableUpdate boolean
Default: false
false
this.sessioncookie.samesite string
StrictLaxNone
this.authcookie.samesite string
StrictLaxNone
this.javaSettings.loadPaths array
this.javaSettings.loadColdFusionClassPath boolean
Default: false
false
this.javaSettings.reloadOnChange boolean
Default: false
false
this.wsChannels array
Default: false
false
this.sameFormFieldsAsArray boolean
Default: false
false
this.compileExtForInclude string
Default: cfm,cfml
cfm,cfml
this.security.antiSamyPolicy string
this.strictNumberValidation boolean
Default: true
true
this.inMemoryFileSystem.enabled boolean
this.inMemoryFileSystem.size numeric
this.datasources struct
this.serialization.preserveCaseForStructKey boolean
Default: false
false
this.serialization.preserveCaseForQueryColumn boolean
Default: false
false
this.serialization.serializeQueryAs string
Default: row
row
rowcolumnstruct
this.customSerializer numeric
this.locale string
Default: en_US
en_US
this.timezone string
America/ChicagoAmerica/New_YorkUTC
this.sessionType string
cfmljee
this.sessionStorage string
Default: memory
memory
this.localMode string
Default: classic
classic
classicmodern
this.scopeCascading string
Default: standard
standard
standardstrictsmall
this.typeChecking boolean
this.compression boolean
Default: false
false
this.passArrayByReference boolean
Default: false
false
true: Arrays will be passed by reference instead of by value for this application. truefalse
this.searchImplicitScopes boolean
Default: true
true
false: Only the variables, local and arguments scopes are searched.true: Default and < CF2016 behavior. All scopes are searched in the following order: local, arguments, thread local, query, thread, variables, cgi, cffile, url, form, cookie, client. truefalse
this.blockedExtForFileUpload string
* (not yet supported on Lucee) to block all extensions or use an empty string to allow all (previous behavior). If not specified the values specified in ColdFusion Administrator take precedence. this.security.samlsettings.idp array
this.security.samlsettings.sp array
Links more information about Application.cfc
- Learn CF in a Week: Application.cfc - Tutorial showing how to use Application.cfc
- onServerStart function - Explanation of how onServerStart is implemented
- JVM flags for cfinclude CF2018u11+ - [CF2018+] -Dcoldfusion.application.recur_resolve.include=true // cfinclude inside Application.cfc will correctly resolve paths relative from the included file
- SAML In ColdFusion CF2021+ - [CF2021+] Details of using SAML Services in ColdFusion.
A very basic script example
component {
this.name = "AppName";
this.datasource = "AppDataSource";
this.sessionManagement = true;
function onApplicationStart() {
application.config="xyz";
}
} This example uses getCurrentTemplatePath and getDirectoryFromPath to dynamically get the directory that the current Application.cfc resides in and then defines some mappings relative to that. You want to avoid using expandPath in Application.cfc because the path will be relative to the current template path not the Application.cfc path.
component {
this.name = "AppName";
this.appBasePath = getDirectoryFromPath(getCurrentTemplatePath());
this.mappings["/components"] = this.appBasePath & "components";
this.mappings["/frameworks"] = this.appBasePath & "frameworks";
} The minimum required to create a WebSocket channel is the name attribute. A channel can also specify a custom channel listener CFC, if not specified the ChannelListener.cfc, available in wwwroot/CFIDE/websocket directory is called (Using Channel Listeners).Note: Though you can use any number of sub-channels, you do not specify them as they are dynamically created (dot notation). To subscribe to channels you create a WebSocket object using the cfwebsocket tag in your CFM template.
component {
this.name = "AppName";
this.wschannels = [{name=channelName, cfclistener=channel_listener_CFC}];
} This example shows how to map to directories that are a level up from the Application.cfc (web root) as well as how to handle an application that will need to be deployed on multiple operating systems (Mac, Unix, Windows) due to differing developer environments. It uses Find to determine if we need to use forward or back slashes in our paths and ListDeleteAt to drop the current directory from the path. We can then build the path for our mappings and custom tags using this information.
component {
this.name = "AppName";
this.currentPath = getDirectoryFromPath( getCurrentTemplatePath() );
this.delim = find("/", this.currentPath) ? "/" : "\";
this.basePath = listDeleteAt(this.currentPath, listLen(this.currentPath, this.delim), this.delim);
this.mappings["/components"] = this.basePath & this.delim & "components";
this.mappings["/frameworks"] = this.basePath & this.delim & "frameworks";
this.customtagpaths = this.basePath & this.delim & "customtags";
}
© 2012–present Foundeo, Inc. and the CFDocs contributors.
Licensed under the MIT License.
ColdFusion is a trademark of Adobe Systems Incorporated.
https://cfdocs.org/application%2Dcfc