Example of callback URL support in ColdFusion Builder

I know this isn’t new - and I’ve blogged it before - but I thought it was cool so I thought I’d share. I’m preparing for an e-seminar tomorrow morning on RIAForge. I decided I’d quickly show off the RIAForge Downloader. If you haven’t seen it before, it’s an extension to ColdFusion Builder that lets you browse and download projects from your IDE. For example:

Right click on a folder and select the extension...

Pick a project...

Browse to the one you want - note - we filter to projects with actual downloads

Select one...

And then all you have to do is click download. Until about a few minutes ago, when you clicked download, it would fetch the bits, use cfzip to unzip them, and then remind you to refresh your Eclipse folder.

But you can actually tell the IDE to refresh itself. Extensions are passed a callbackurl value that points to a service that accepts XML. You take your XML commands and simply CFHTTP to the server.

<!--- data is a variable containing the data Builder sends to all extensions. ---> <cfset cburl = data.event.ide.callbackurl.xmltext> <cfsavecontent variable="cbxml"> <cfoutput> <response> <ide> <commands> <command type="refreshfolder"> <params> <param key="foldername" value="#basedirectory#" /> </params> </command> </commands> </ide> </response> </cfoutput> </cfsavecontent> <cfhttp method="post" url="#cburl#" result="commandresponse"> <cfhttpparam type="body" value="#cbxml#" > </cfhttp>

And voila - no need to tell the user to refresh the folder, it happens automagically. Other callback commands exist - just check the docs. I've also written a "helper" CFC you can download here that makes this even easier to use.

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Comments