cfapplication

Defines the scope of a ColdFusion application; enables and disables storage of Client variables; specifies the Client variable storage mechanism; enables Session variables; and sets Application variable timeouts.

Application framework tags

<cfapplication 
name = "application_name"
loginStorage = "cookie" or "session"
clientManagement = "Yes" or "No"
clientStorage = "datasource_name" or "Registry" or "Cookie"
setClientCookies = "Yes" or "No"
sessionManagement = "Yes" or "No"
sessionTimeout = #CreateTimeSpan(days, hours, minutes, seconds)#
applicationTimeout = #CreateTimeSpan(days, hours, minutes, seconds)#
setDomainCookies = "Yes" or "No">

cfassociate, cferror, cflock, cfmodule

ColdFusion MX 6.1: Added loginStorage attribute

ColdFusion MX:

Attribute Req/Opt Default Description

name

See Description

 

Name of application. Up to 64 characters.

For Application and Session variables: Required.

For Client variables: Optional

loginStorage

Optional

cookie

  • cookie: store login information in the Cookie scope
  • session: store login information in the Session scope

clientManagement

Optional

No

  • Yes: enables client variables
  • No

clientStorage

Optional

registry

How client variables are stored:

  • datasource_name: in ODBC or native data source. You must create storage repository in the Administrator.
  • registry: in the system registry.
  • cookie: on client computer in a cookie. Scalable. If client disables cookies in the browser, client variables do not work.

setClientCookies

Optional

Yes

  • Yes: enables client cookies
  • No: ColdFusion does not automatically send CFID and CFTOKEN cookies to client browser; you must manually code CFID and CFTOKEN on the URL for every page that uses Session or Client variables.

sessionManagement

Optional

No

  • Yes: enables session variables
  • No

sessionTimeout

Optional

Specified in Variables page of ColdFusion Administrator

Lifespan of session variables. CreateTimeSpan function and values in days, hours, minutes, and seconds, separated by commas.

applicationTimeout

Optional

Specified in Variables page of ColdFusion Administrator

Lifespan of application variables. CreateTimeSpan function and values in days, hours, minutes, and seconds, separated by commas.

setDomainCookies

Optional

No

  • Yes: Sets CFID and CFTOKEN cookies for a domain (not a host). Required, for applications running on clusters.
  • No

This tag is typically used in the Application.cfm file, to set defaults for a ColdFusion application.

This tag enables application variables, unless they are disabled in the ColdFusion Administrator. The Administrator setting also overrides the sessionManagement attribute. For more information, see Configuring and Administering ColdFusion MX.

Server, application, and session variables

When you display, set, or update variables in the server, application, and session scopes, use the cflock tag with the scope attribute set to the following value:

For information about locking scopes, see cflock.

If ColdFusion is running on a cluster, you must specify clientStorage = "cookie" or a data source name; you cannot specify "registry".

If you use this tag to activate the Application and Client scopes, ColdFusion saves the application name as a key, whose maximum length is 64 characters. If an application name is longer than this, the client store fails during database processing.

Note: The CFTOKEN variable is 8 bytes in length. Its range is 10000000 -99999999.If you specify ClientStorage=cookie, any Client scope variables set following a cfflush tag are not saved in the Client browser.

<!--- This example shows how to use cflock to guarantee consistent data 
updates to variables in Application, Server, and Session scopes. ---> <h3>cfapplication Example</h3> <p>cfapplication defines scoping for a ColdFusion application and
enables or disables the storing of application and/or sessionvariables.
This tag is placed in a special file calledApplication.cfm that is run
before any other CF page in a directory where the Application.cfm file
appears. <cfapplication name = "ETurtle" sessionTimeout = #CreateTimeSpan(0, 0, 0, 60)# sessionManagement = "Yes"> <!--- Initialize session and application variables used by E-Turtleneck.
Use session scope for session variables. ---> <cflock scope = "Session" timeout = "30" type = "Exclusive"> <cfif NOT IsDefined("session.size")> <cfset session.size = ""> </cfif> <cfif NOT IsDefined("session.color")> <cfset session.color = ""> </cfif> </cflock> <!--- Use the application scope for the application variable. This variable
keeps track of total number of turtlenecks sold. ---> <cflock scope = "Application" timeout = "30" type = "Exclusive"> <cfif NOT IsDefined("application.number")> <cfset application.number = 1> </cfif> </cflock> <cflock scope = "Application" timeout = "30" type = "readOnly"> <cfoutput> E-Turtleneck is proud to say that we have sold #application.number#
turtlenecks to date. </cfoutput> </cflock> <!--- End of Application.cfm --->

View comments on LiveDocs