Debugging Flex with ColdFire

Recently I went back to doing Flex work and one of the things I immediately missed was ColdFire. So I decided to take a look to see what could be done to get my favorite debugging tool working with CF powered Flex applications. Turns out it wasn't all that hard. First though, check out the video below to get an idea of what I'm talking about. (Sorry, no sound as I recorded this at work.)

What the video shows is me clicking around a quick demo app I put together with the CF/Flex application generation wizard. As you can see, I now have access to all of my CF debugging info down in the ColdFire panel. So how did I do this? Easy, just include coldfire.cfm onRequestEnd. It turns out that while remote CFC calls do not include the debugging template specified in the CF administrator, the debugging service does run, so we just need to include our debugging template manually. For this example I just put coldfire.cfm in the components directory along with the following Application.cfc:

<cfcomponent>
<cffunction name="onRequestEnd">
<cfinclude template="coldfire.cfm">
</cffunction>
</cfcomponent>

I then was able to see all my query and execution info and do trace and timer calls. The only thing that won't work is the Variables tab as everything is happening in CFCs. However, with the new enhanced tracing option I can still easily dump variables out to coldfire, as the video shows.

I haven't tested this yet, but this approach may work with other remote CFC calls, say via cfajaxproxy. If anyone tries this approach with other remote CFC calls please let me know how it works out.

As a side note, all of this ColdFire/Flex goodness has also got me thinking about something else. Now this is some Mozilla/Firefox geekery, but Firefox 3.0.4 added a new interface, nsITraceableChannel, which combined with the nsIBinaryInputStream interface should, in theory, allow you to parse AMF messages into JavaScript objects for display in Firebug. Think something like Service Capture in Firebug. This really just an idea at this point, but I've started looking at the BlazeDS code and I think it may be doable. If anyone has experience with the AMF protocol and would like to lend a hand, please let me know.

Comments
Raymond Camden's Gravatar Ok, that is slick.
# Posted By Raymond Camden | 12/23/08 3:44 PM
Gareth Arch's Gravatar Nice! I've pretty much just been using the Flex debugger and browsing the the CFC using the URL when I've been testing which is a bit of a pain, to say the least.
This should make things much simpler. Thanks for the tip.
# Posted By Gareth Arch | 12/24/08 9:46 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.