initial
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<cfcomponent extends="taffy.core.api">
|
||||
<cfscript>
|
||||
this.name = hash(getCurrentTemplatePath());
|
||||
|
||||
variables.framework = {};
|
||||
variables.framework.reloadKey = "reload";
|
||||
|
||||
/*
|
||||
You should NOT create your bean factory instance out here because that would cause it to be
|
||||
re-created for every request, which is not going to be efficient at all!
|
||||
|
||||
Because of the Taffy Request Lifecycle, onApplicationStart is called BEFORE inspecting
|
||||
your framework default settings, so you can optionally set the bean factory into
|
||||
variables.framework from inside onApplicationStart.
|
||||
|
||||
Note that this does not stop you from setting values above; as I've set the value for
|
||||
reloadKey. You can mix implementations like this; but anything that will have a significant
|
||||
load time should be done in onApplicationStart.
|
||||
*/
|
||||
|
||||
function onApplicationStart(){
|
||||
application.coldspring = createObject("component", "coldspring.beans.DefaultXMLBeanFactory");
|
||||
application.coldspring.loadBeans('config/coldspring.xml');
|
||||
|
||||
variables.framework.beanFactory = application.coldspring;
|
||||
|
||||
return super.onApplicationStart();
|
||||
}
|
||||
</cfscript>
|
||||
</cfcomponent>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans default-autowire="byName">
|
||||
|
||||
<bean id="fakeData" class="taffy.examples.shared.fakeData" />
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,6 @@
|
||||
<!---
|
||||
DO NOT DELETE THIS FILE
|
||||
===============================
|
||||
This file is necessary for Taffy to work, but should be blank.
|
||||
All requests funnel through it, but are handled by framework internal functionality.
|
||||
--->
|
||||
@@ -0,0 +1,13 @@
|
||||
<cfcomponent extends="taffy.core.resource" taffy_uri="/artfarts">
|
||||
|
||||
<cffunction name="get" access="public" output="false">
|
||||
<cfreturn representationOf(variables.fakeData.getData()) />
|
||||
</cffunction>
|
||||
|
||||
<!--- this will be called by the bean factory's autowire functionality --->
|
||||
<cffunction name="setFakeData" access="public" output="false" returnType="void">
|
||||
<cfargument name="fakeDataObj" type="any" required="true" hint="Shared FakeData object" />
|
||||
<cfset variables.fakeData = arguments.fakeDataObj />
|
||||
</cffunction>
|
||||
|
||||
</cfcomponent>
|
||||
Reference in New Issue
Block a user