Here's the XML for CS 1.2:

<bean id="adminANPService_remote"
        class="coldspring.aop.framework.RemoteFactoryBean">
<property name="target"><ref bean="adminANPService"/></property>
<property name="serviceName"><value>adminANPServiceRemote</value></property>
<property name="relativePath"><value>${remotingRelativePath}</value></property> <property name="remoteMethodNames"><value>doesAdminNameExist</value></property>
</bean>

In this case, I also have a bean "adminANPService" in which is the target bean for the remote facade. The value of ${remotingRelativePath} is "/remoting" which ultimately resolves to example.com/remoting/adminANPServiceRemote.cfc (the name of the generated CFC is indicated in the "serviceName" property).

There's an option parameter in the CSProperty that you can add:

<parameter name="generateRemoteProxies" value="true"/>

This will look for any RemoteFactoryBean defined in your CS configuration file and regenerate them when you reload your application. Right now CS won't regenerate the remote proxy if the file exists on disk. The other way of doing it is deleting the CFCs from the remoting directory but this way is definitely easier.

Personally, I'm moving to using REST endpoints for all my AJAX proxying in Mach-II. While the remote factory stuff in ColdSpring is good, it doesn't offer many extension points unless you get into AOP and usually the AOP only applies to AJAX calls. It ends up being a lot of configuration.

REST is easier to manage for us...

<cffunction name="temp" access="public" returntype="string" output="false"
        hint="Temp testing method. To be removed"
        rest:uri="/temp"
        rest:method="PUT">

<cfreturn "temp" />
</cffunction>

The JS (in Prototype):

new Ajax.Request("/index.cfm/dashboard.api/memory", {
   method: 'DELETE'
   , onCreate: function() {
        currentObject.stopMemoryInformation();
        currentObject.startGarbageCollectionTimer();
        $('gcRun').fade({ duration: 0.5, queue: 'end' });
        $('gcInProgress').appear({ duration: 0.5, queue: 'end' });
    }
    , onSuccess: function(transport) {
        currentObject.startMemoryInformation();
currentObject.stopGarbageCollectionTimer(transport.getHeader("recoveredMemory"));
        $('gcInProgress').fade({ duration: 0.5, queue: 'end' });
        $('gcRun').appear({ duration: 0.5, queue: 'end' });
    }
, on403: myGlobalHandler.loginRedirect.bindAsEventListener(currentObject)
});


jlcox said the following on 10/11/2010 08:08 AM:
Another option would be to call a RemoteFacade CFC setup
via ColdSpring.
Kurt, can you elaborate on this? Right now I'm doing Ajax calls
through a proxy object that references the services created by
ColdSpring through application.service Factory, i.e.,

<cfcomponent output="false" hint="Used by jQuery Ajax getJSON function
calls" displayname="proxy Service">
   <cfsetting showdebugoutput="no" enablecfoutputonly="yes"/>
   <cfcontent reset="yes" />
   <!---ColdSpring--->
   <cfset variables.sf = application.serviceFactory />
   <!--- general-purpose proxy function...will pass through any method
and arguments thrown at it to the underlying service --->

<cffunction name="proxy" access="remote" returntype="any"
output="false">
     <cfargument name="service" type="string" required="yes"/>
     <cfargument name="remotemethod" type="string" required="yes"/>
     <cfset var svc = variables.sf.getBean(arguments.service) />
     <cfset var outvar = 0 />
     <cfinvoke component="#svc#" method="#arguments.remoteMethod#"
argumentcollection="#arguments#" returnvariable="outVar" />
     <cfreturn outVar />
   </cffunction>
</component>

If I could directly call a RemoteFacade created by ColdSpring I could
avoid having to instantiate a proxy service on each call, but I'm
unclear how to reference the RemoteFacade from within jQuery.


--
You received this message because you are subscribed to Mach-II for CFML list.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/mach-ii-for-coldfusion?hl=en

***New URLs as of April 29th, 2010***
SVN: http://svn.mach-ii.com/machii/
Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/

Reply via email to