/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. //do your onApplicationStart stuff here
  5. function applicationStartEvent(){
  6. application.beanFactory = createObject("component", "coldspring.beans.DefaultXMLBeanFactory");
  7. application.beanFactory.loadBeans('config/coldspring.xml');
  8. }
  9. //do your onRequestStart stuff here
  10. function requestStartEvent(){}
  11. //this function is called after the request has been parsed and all request details are known
  12. function onTaffyRequest(string verb, string cfc, struct requestArguments, string mimeExt){
  13. //this would be a good place for you to check API key validity and other non-resource-specific validation
  14. return true;
  15. }
  16. //called when taffy is initializing or when a reload is requested
  17. function configureTaffy(){
  18. setBeanFactory(application.beanfactory);
  19. setDebugKey("debug");
  20. setReloadKey("reload");
  21. setReloadPassword("true");
  22. //you could change this to a custom class to change the default instead of specifying an override for each response
  23. setDefaultRepresentationClass("taffy.core.genericRepresentation");
  24. }
  25. </cfscript>
  26. </cfcomponent>