Adobe ColdFusion 8

Setting application properties

You can specify application properties by setting This scope variables in the Application.cfc initialization code. (These are the same properties that you can set in the cfapplication tag.) The following table lists the This scope variable that ColdFusion uses to set application properties and describes their uses.

Variable

Default

Description

applicationTimeout

Administrator value

Life span, as a real number of days, of the application, including all Application scope variables. Use the createTimeSpan function to generate this variable.

clientManagement

False

Whether the application supports Client scope variables.

clientStorage

Administrator value

Where Client variables are stored; can be cookie, registry, or the name of a data source.

loginStorage

Cookie

Whether to store login information in the Cookie scope or the Session scope.

scriptProtect

Administrator Value

Whether to protect variables from cross-site scripting attacks.

sessionManagement

False

Whether the application supports Session scope variables.

sessionTimeout

Administrator Value

Life span, as a real number of days, of the user session, including all Session variables. Use the createTimeSpan function to generate this variable.

setClientCookies

True

Whether to send CFID and CFTOKEN cookies to the client browser.

setDomainCookies

False

Whether to use domain cookies for the CFID and CFTOKEN values used for client identification, and for Client scope variables stored using cookies. If False, ColdFusion uses host-specific cookies. Set to True for applications running on clusters.

The following example code from the top of an Application.cfc sets the application name and properties:

<cfcomponent>
<cfset This.name = "TestApplication">
<cfset This.clientmanagement="True">
<cfset This.loginstorage="Session">
<cfset This.sessionmanagement="True">
<cfset This.sessiontimeout="#createtimespan(0,0,10,0)#">
<cfset This.applicationtimeout="#createtimespan(5,0,0,0)#">

For more information on these settings, see cfapplication in the CFML Reference.

Setting page processing options

The cfsetting tag lets you specify the following page processing attributes that you might want to apply to all pages in your application:

Attribute

Use

showDebugOutput

Specifies whether to show debugging output. This setting cannot enable debugging if it is disabled in the ColdFusion Administrator. However, this option can ensure that debugging output is not displayed, even if the Administrator enables it.

requestTimeout

Specifies the page request time-out. If ColdFusion cannot complete processing a page within the time-out period, it generates an error. This setting overrides the setting in the ColdFusion Administrator. You can use this setting to increase the page time-out if your application or page frequently accesses external resources that might be particularly slow, such as external LDAP servers or web services providers.

enableCFOutputOnly

Disables output of text that is not included inside cfoutput tags. This setting can help ensure that extraneous text that might be in your ColdFusion pages does not get displayed.

Often, you use the cfsetting tag on individual pages, but you can also use it in your Application.cfc file. For example, you might use it in multi-application environment to override the ColdFusion Administrator settings in one application.

You can put an application-wide cfsetting tag in the component initialization code, normally following the This scope application property settings, as the following example shows:

<cfcomponent>
<cfscript>
    This.name="MyAppl";
    This.clientmanagement="True";
    This.loginstorage="Session" ;
    This.sessionmanagement="True" ;
    This.sessiontimeout=CreateTimeSpan(0,0,1,0);
</cfscript>
<cfsetting showdebugoutput="No" enablecfoutputonly="No">

The cfsetting tag in this example affects all pages in an application. You can override the application-wide settings in the event methods, such as onRequestStart, or on individual ColdFusion pages.