Rob Gonda's Blog

CFUG speech first followup

I received a few questions after my speech last night at the South Florida CFUG; some by email, some by comments so I decided to address them in a new post. This is the first post, but more will come. Yaron asks:

1. DWREngine._execute function sends the callback function the structure received from the component. Is it possible to pass an additional element to that function as well?
Example: Call back function ReportInventory(getInventory) receives a query structure, but I would also like to pass a form field (e.g. Form.Sizes) for further manipulation within that function. Is this possible?

2. You mentioned, but did not have enough time to show us, a tool you use for debugging. I believe you called it an HTTP spoofer…can you tell me a little bit about it.
1. It is a good question, but unfortunately, it is not possible to pass additional arguments to the call handler. That change could be quite complicated, because the framework manages unlimited simultaneous requests in a batch, so I would have to create an additional structure to support additional information, link it to the request ID, check for it in the callback handler, and invoke your function passing the additional arguments.... I can add that to my to-do list, but honestly it may take a while. For now you can overcome it in two different ways: 1) you can save a globally accessible var in JS, or 2) you can send the values you need to CF and have it send them back with the response. The project is open source, and I am receiving some nice add-ons lately, so I encourage anyone who wants to take this challenge to give it a try.

2. To debug AJAX requests I use what is called HTTP sniffers. There are a couple of good ones out there and it will require a full post to explain them all and how to use them. For now I will recommend using HTTP Live headers if you use FireFox, or Fiddler if you use IE. A third, more complicated, and more powerful tool is Ethereal, but it goes way beyond HTTP traffic. I recently started using FireBug for Firefox too. It's really nice, I just wish you could detach it from the main browser.

Some sniffers will follow the request and response and provide all information in a centralized place, others will just show you the request, but if you're using the 'get' verb (default on ajaxCFC), you can copy/paste that request in a browser and call it directly. Doing this way you will see ColdFusion errors too.

When you're really to deploy your app live, change a few settings in ajaxCFC: use 'post' verbs, make it check referrer, and check sessions.

** updated, added Firebug for the http traffic sniffers

TrackBacks
There are no trackbacks for this entry.

Trackback URL for this entry:
http://www.robgonda.com/blog/trackback.cfm?9EFCB95D-3048-7431-E4EFE26EAEFD1749

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
This blog is running version 5.9.003. Contact Blog Owner