Ask Ben: Accessing Cached CFCs With AJAX via Remote Proxies

<cfcomponent
	output="false"
	hint="I provide application settings and define event handlers.">
 
	<!--- Define application settings. --->
	<cfset THIS.Name = "Ajax #Hash( GetCurrentTemplatePath() )#" />
	<cfset THIS.ApplicationTimeout = CreateTimeSpan( 0, 0, 5, 0 ) />
	<cfset THIS.SessionManagement = false />
 
 
	<cffunction
		name="OnApplicationStart"
		access="public"
		returntype="boolean"
		output="false"
		hint="I execute when an application needs to be initialized.">
 
		<!--- Clear any existing data (if manually init). --->
		<cfset StructClear( APPLICATION ) />
 
		<!--- Create and cache a message service. --->
		<cfset APPLICATION.MessageService = CreateObject( "component", "MessageService" ).Init() />
 
		<!--- Return true to let app fully initialize. --->
		<cfreturn true />
	</cffunction>
 
 
	<cffunction
		name="OnRequestStart"
		access="public"
		returntype="boolean"
		output="false"
		hint="I execute when a request needs to be initialized.">
 
		<!--- Check for manual initialization. --->
		<cfif StructKeyExists( URL, "reset" )>
 
			<!--- Manually re-initialize application. --->
			<cfset THIS.OnApplicationStart() />
 
		</cfif>
 
		<!--- Return true to let request fully initialize. --->
		<cfreturn true />
	</cffunction>
 
</cfcomponent>

For Cut-and-Paste