How do I access CFCProxy in Lucee?

70 views
Skip to first unread message

JP

unread,
Sep 22, 2016, 6:49:56 PM9/22/16
to Lucee
I want to use CFCProxy to make calls into CF from a Java class. In the examples I've seen I need import the CFCProxy class into my java class as follows:

import coldfusion.cfc.CFCProxy;

First question... is CFCProxy implemented? If so, how do I tell my Java compiler where it is?

JP

unread,
Sep 23, 2016, 5:39:38 PM9/23/16
to Lucee
To anyone looking to build a java class that uses the CFCProxy, here's what I figured out:

Add the lucee.jar to your classpath when compiling your class (for me it's C:/lucee/lib/lucee.jar)

In your yourclass.java, add:

import coldfusion.cfc.CFCProxy;

Create an instance of your CFC:

cfcConnector = new CFCProxy(cfcPath, true); //cfcPath needs to be absolute

Then to call the onMessage() method in your CFC:

Object[] args = { "my message" };
cfcConnector
.invoke("onMessage", args); // call the method "onMessage" defined in your CFC

Igal @ Lucee.org

unread,
Sep 25, 2016, 12:26:34 PM9/25/16
to lu...@googlegroups.com

Hey John,

You can also create a CFC like this:

    CFMLEngine engine = CFMLEngineFactory.getInstance();
    Creation creationUtil = engine.getCreationUtil();
    PageContext pageContext = engine.getThreadPageContext();
    Component cfc = creationUtil.createComponentFromName(pageContext, "package.ComponentName");

See http://docs.lucee.org/guides/working-with-source/java-using-lucee-in-java.html for more.

Igal Sapir
Lucee Core Developer
Lucee.org

--
Get 10% off of the regular price for this years CFCamp in Munich, Germany (Oct. 20th & 21st) with the Lucee discount code Lucee@cfcamp. 189€ instead of 210€. Visit https://ti.to/cfcamp/cfcamp-2016/discount/Lucee@cfcamp
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/71e7fe7b-705e-4a96-a0d0-3f4182f2cb0b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted

JP

unread,
Sep 28, 2016, 4:47:25 PM9/28/16
to Lucee
@Igal, will that give me the current session, etc?

Btw, I would love to see some working code examples from that page you referenced (http://docs.lucee.org/guides/working-with-source/java-using-lucee-in-java.html). I've played around with some of those code examples, and it was challenging to find all the import classes that are needed. As someone who knows just enough about Java to compile and build, and write some basic code, it's not clear which libraries are needed and it took me several hours just to get my code to compile.


On Thursday, September 22, 2016 at 4:49:56 PM UTC-6, JP wrote:

Igal @ Lucee.org

unread,
Sep 28, 2016, 5:47:52 PM9/28/16
to lu...@googlegroups.com

John,

I wrote that document originally years ago, back in the Railo days.  Micha added to it some recent, Lucee-5 stuff.  The PageContext in the example is not linked to the correct Application, so it does not give you the correct session.

Lucee is made of two parts:  Loader and Core.  Loader provides an API, while Core is "use-at-your-own-risk" private implementations.  To run the code examples, you need to have the Lucee Loader, which is exposed via the Lucee.jar in your classpath.

In general we would love to see more Java users' involvement and/or contributions, so it'd be great if you can update whatever errors you find in the Wiki.

I'm considering working on a Websocket implementation for Lucee, possibly as an extension, but am still collecting information as to how it would be best used.  I also need to discuss this with Micha and others before we implement anything.


Igal Sapir
Lucee Core Developer
Lucee.org

--
Get 10% off of the regular price for this years CFCamp in Munich, Germany (Oct. 20th & 21st) with the Lucee discount code Lucee@cfcamp. 189€ instead of 210€. Visit https://ti.to/cfcamp/cfcamp-2016/discount/Lucee@cfcamp
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.

JP

unread,
Sep 29, 2016, 1:41:10 AM9/29/16
to Lucee
I was hoping to use cfcproxy to call into my app from within a Java websocket wrapper. That reference page you wrote could be really cool if it included links to working sample code or some sort of SDK would be a great place to start. I don't consider myself a Java developer, but I'm definitely interested in getting more fluent so that I could extend my Lucee apps.

Lucee really needs a websocket solution badly. I hope a solution can be built soon!

Mark Drew

unread,
Sep 29, 2016, 3:01:55 AM9/29/16
to lu...@googlegroups.com
Might be worth looking at this ??



Mark Drew
- Sent by typing with my thumbs. 
Reply all
Reply to author
Forward
0 new messages