Whatever message this page gives is out now! Go check it out!
createDynamicProxy(cfc, [interfaces])Name | Description |
cfc | Fully qualified name of the ColdFusion component or a CFC instance. |
interfaces | An array of Java interfaces for which you want to create the dynamic proxy. |
public interface MyInterface
{
public String sayHello();
}public class InvokeHelloProxy
{
private MyInterface myInterface;
public InvokeHelloProxy(MyInterface x)
{
this.myInterface = x;
}
public String invokeHello()
{
return myInterface.sayHello();
}
}<cfcomponent>
<cffunction name="sayHello" returntype="string">
<cfreturn "Hello World!!!!">
</cffunction>
</cfcomponent><cfset THIS.javaSettings = {LoadPaths = ["/lib"],reloadOnChange=true,watchInterval=10}/><cfset dynInstnace = createDynamicProxy("HelloWorld.cfc", ["MyInterface"])>
<cfset x = createObject("java","InvokeHelloProxy").init(dynInstnace)>
<cfset y = x.invokeHello()>
<cfoutput>#y#</cfoutput><cfset instance=new helloWorld()>
<cfset dynInstnace = createDynamicProxy(instance, ["MyInterface"])>
<cfset x = createObject("java","InvokeHelloProxy").init(dynInstnace)>
<cfset y = x.invokeHello()>
<cfoutput>#y#</cfoutput>