![]() ![]() ![]() |
||
|
The following table briefly describes the application event CFC methods that you can implement, including when they are triggered. The following sections describe how to use these methods in more detail.
Method |
When run |
---|---|
|
The application first starts: when the first request for a page is processed or the first CFC method is invoked by an event gateway instance, Flash Remoting request, or a web service invocation. This method is useful for setting application-wide (Application scope) variables, such as the names of data sources. |
|
The application ends: when the application times out or the server shuts down. |
|
A new session is created as a result of a request that is not in an existing session, including ColdFusion event gateway sessions. The application must enable sessions for this event to happen. |
|
A session time-out setting is reached or, if using J2EE sessions, the user closes the browser. This event is not triggered when the application ends or the server shuts down. |
|
ColdFusion receives any of the following: a request, an HTTP request (for example, from a browser), a message to an event gateway, a SOAP request, or a Flash Remoting request. |
|
The |
|
All pages and CFCs in the request have been processed: equivalent to the OnRequestEnd.cfm page. |
|
When an exception occurs that is not caught by a try/catch block. |
When ColdFusion MX receives a request, it instantiates the Application CFC and runs the Application.cfc code in the following order:
onApplicationStart
, if not run before for this applicationonSessionStart
, if not run before for this sessiononRequestStart
onRequest
, or the requested page if there is no onRequest methodonRequestEnd
The following methods are triggered by specific events:
onApplicationEnd
onSessionEnd
onError
The onApplicationEnd
and onSessionEnd
methods do not execute in the context of a page request, so they cannot access request variables or display information to the user. The OnError
method does not always execute in the context of a request; you can use its Event
argument to determine the context.
|
||
![]() ![]() ![]() |