root/coldbox/trunk/ApplicationTemplate/handlers/main.cfc @ 2105

Revision 2105, 2.7 kB (checked in by lmajano, 4 years ago)

small refactorings

Line 
1<!-----------------------------------------------------------------------
2Author   :      Your Name
3Date     :      September 25, 2005
4Description :
5        This is a ColdBox event handler where all implicit methods can go.
6        Thus its the main handler.
7
8Please note that the extends needs to point to the eventhandler.cfc
9in the ColdBox system directory.
10extends = coldbox.system.EventHandler
11
12----------------------------------------------------------------------->
13<cfcomponent name="main" extends="coldbox.system.EventHandler" output="false">
14
15<!------------------------------------------- CONSTRUCTOR ------------------------------------------>
16
17        <!--- This init is mandatory, including the super.init(). --->
18        <cffunction name="init" access="public" returntype="main" output="false">
19                <cfargument name="controller" type="any">
20                <cfset super.init(arguments.controller)>
21                <!--- Any constructor code here --->
22                <cfreturn this>
23        </cffunction>
24
25<!------------------------------------------- GLOBAL IMPLICIT EVENTS ONLY ------------------------------------------>
26<!--- In order for these events to fire, you must declare them in the coldbox.xml.cfm --->
27       
28        <!--- Default Action --->
29        <cffunction name="index" access="public" returntype="void" output="false">
30                <cfargument name="Event" type="any">
31                <cfset setNextEvent(getSetting('DefaultEvent'))>
32        </cffunction>
33       
34        <cffunction name="onAppInit" access="public" returntype="void" output="false">
35                <cfargument name="Event" type="any">
36                <!--- ON Application Start Here --->
37        </cffunction>
38
39        <cffunction name="onRequestStart" access="public" returntype="void" output="false">
40                <cfargument name="Event" type="any">
41                <!--- On Request Start Code Here --->
42        </cffunction>
43
44        <cffunction name="onRequestEnd" access="public" returntype="void" output="false">
45                <cfargument name="Event" type="any">
46                <!--- ON Request End Here --->
47        </cffunction>
48       
49        <cffunction name="onSessionStart" access="public" returntype="void" output="false">
50                <cfargument name="Event" type="any">
51                <!--- ON session start Here --->
52        </cffunction>
53       
54        <cffunction name="onSessionEnd" access="public" returntype="void" output="false">
55                <cfargument name="Event" type="any">
56                <!--- ON session End Here --->
57                <cfset var sessionScope = event.getValue("sessionReference")>
58                <cfset var applicationScope = event.getValue("applicationReference")>
59               
60        </cffunction>
61
62        <cffunction name="onException" access="public" returntype="void" output="false">
63                <cfargument name="Event" type="any">
64                <!--- ON Exception Handler Here --->
65                <cfscript>
66                        //Grab Exception From request collection, placed by ColdBox
67                        var exceptionBean = event.getValue("ExceptionBean");
68                        //Place exception handler below:
69
70                </cfscript>
71        </cffunction>
72
73
74</cfcomponent>
Note: See TracBrowser for help on using the browser.