Adobe COLDFUSION 9 Manual page 245

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Developing CFML Applications
• If you do not have an Application.cfc, but do have an Application.cfm page, ColdFusion looks for an
OnRequestEnd.cfm in the same directory as the Application.cfm page ColdFusion uses for the current page.
ColdFusion does not search beyond that directory, so it does not run an OnRequestEnd.cfm page that resides
in another directory. Also, the OnRequestEnd.cfm page does not run if there is an error or an exception on the
application page, or if the application page executes the
The following rules determine how ColdFusion processes application pages and settings:
• ColdFusion processes only one Application.cfc or Application.cfm page for each request. If a ColdFusion page has
a
tag pointing to an additional ColdFusion page, ColdFusion does not search for an Application.cfc or
cfinclude
Application.cfm page when it includes the additional page.
• If a ColdFusion page has a
processes the
cfapplication
application name and the behaviors set by the
• You can have multiple Application.cfc files, Application.cfm files, and
application name. In this case, all pages that have the same name share the same application settings and
Application scope and set and get all the variables in this scope. ColdFusion uses the parameter settings of the
tag or the most recently processed file, if the settings, such as the session time-out, differ among
cfapplication
the files.
Note: If your application runs on a UNIX platform, which is case-sensitive, spell Application.cfc, Application.cfm, and
OnRequestEnd.cfm with capital letters.
Defining the directory structure
Defining an application directory structure with an application-specific root directory has the following advantages:
The application is easier to develop and maintain, because the application page files are well-organized.
Development
You can easily move the application to another server or another part of a server without changing any
Portability
code in the application page files.
Application pages that are under the same directory can share application-level settings and
Application-level settings
functions.
Application pages that are under the same directory can share web server security settings.
Security
When you place your application in an application-specific directory hierarchy, you can use a single application
definition (Application.cfc or Application.cfm) page in the application root directory, or place different application
definition pages that govern individual sections of the application in different directories.
You divide your logical web application into multiple ColdFusion applications by using multiple application definition
pages with different application names. Alternatively, use multiple application definition pages that specify the same
application name, but have different code, for different subsections of your application.
The directory trees in the following image show two approaches to implementing an application framework:
• In the example on the left, a company named Web Wonders, Inc. uses a single Application.cfc file installed in the
application root directory to process all application page requests.
tag, it first processes any Application.cfc or Application.cfm, and then
cfapplication
tag. The tag overrides the settings from the application files, including the
cfapplication
Last updated 8/5/2010
or
tag.
cfabort
cfexit
tag attributes.
cfapplication
tags that use the same
240

Advertisement

Table of Contents
loading

Table of Contents