
242
DEVELOPING
COLDFUSION 9 APPLICATIONS
Developing CFML Applications
Las
t
upda
te
d 8/5/2010
Naming the application
Define the application and give it a name by setting the This.name variable in the Application.cfc initialization section,
before the method definitions. By using a specific application name, you define a set of pages as part of the same logical
application.
ColdFusion supports unnamed applications, which are useful for ColdFusion applications that must interoperate with
JSP tags and servlets. Consider creating an unnamed application
only
if your ColdFusion pages must share Application
or Session scope data with existing JSP pages and servlets. You cannot have more than one unnamed application on a
server instance. For more information on using unnamed applications, see “
Sharing data between ColdFusion pages
and JSP pages or servlets
” on page 1130.
Setting application properties
Specify application properties by setting This scope variables in the Application.cfc initialization code. (These are the
same properties that you set in the
cfapplication
tag.) The following table lists the This scope variable that
ColdFusion uses to set application properties and describes their uses.
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 to apply to all pages in your application:
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.
Содержание COLDFUSION 9
Страница 1: ...Developing Applications ADOBE COLDFUSION 9...