PageRenderTime 5ms CodeModel.GetById 2ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/examples/api_both/Application.cfc

http://github.com/atuttle/Taffy
ColdFusion CFScript | 31 lines | 20 code | 5 blank | 6 comment | 0 complexity | e938b172c962ab6850c7a1e3f3887593 MD5 | raw file
 1<cfcomponent extends="taffy.core.api">
 2	<cfscript>
 3		this.name = hash(getCurrentTemplatePath());
 4
 5		//do your onApplicationStart stuff here
 6		function applicationStartEvent(){
 7			application.beanFactory = createObject("component", "coldspring.beans.DefaultXMLBeanFactory");
 8			application.beanFactory.loadBeans('config/coldspring.xml');
 9		}
10
11		//do your onRequestStart stuff here
12		function requestStartEvent(){}
13
14		//this function is called after the request has been parsed and all request details are known
15		function onTaffyRequest(string verb, string cfc, struct requestArguments, string mimeExt){
16			//this would be a good place for you to check API key validity and other non-resource-specific validation
17			return true;
18		}
19
20		//called when taffy is initializing or when a reload is requested
21		function configureTaffy(){
22			setBeanFactory(application.beanfactory);
23			setDebugKey("debug");
24			setReloadKey("reload");
25			setReloadPassword("true");
26
27			//you could change this to a custom class to change the default instead of specifying an override for each response
28			setDefaultRepresentationClass("taffy.core.genericRepresentation");
29		}
30	</cfscript>
31</cfcomponent>