View unanswered posts | View active topics It is currently September 9th, 2010, 4:13 am



Reply to topic  [ 3 posts ] 
Framework plugins ("flXHRproxy") 
Author Message
Site Admin

Joined: May 30th, 2008, 1:31 pm
Posts: 370
Location: Austin, TX
Post Framework plugins ("flXHRproxy")
[Moderator: Edited to include references to the new Prototype plugin]

I noticed that some people are wondering more about the jQuery 'flXHRproxy' plugin, Dojo 'flXHRproxy' plugin, and Prototype 'flXHRproxy' plugin and how to use them. So, this is an attempt to try and help shed some light on the subject.

flXHR has several different configuration options which significantly affect its behavior/functionality, such as turning on or off XML response translation or overriding the default policy file location.

So, you may need to use different instance options for different remote server destinations within your application/mashup. For instance, when calling an RSS feed, you may want XML on, but when calling a JSON API, you may want it off to avoid unnecessary XML processing of a non-XML response.

All the framework flXHRproxy plugins have a single primary function called "registerOptions(...)". This function looks and acts the same for all frameworks. It takes two parameters.

The first is the URL (or partial beginning fragment of a URL) to match against. The second parameter is an object (object literal). This object is identical to the object you pass in with named keys for regular flXHR configuration, so any flXHR configuration parameters can be set here. The object will be saved and passed in, as-is, to flXHR for instance configuration.

Whenever you make an Ajax call later in your application, the target URL that you are calling will be matched against all registered URL's. When the first match is found, the plugin will use those configuration options to instantiate flXHR as the transport for that Ajax call.

For Dojo, the DojoX.io | XHR Plugins extension will automatically URL match and select flXHRproxy for transport if the Ajax call warrants it. The same is true for the Prototype flXHRproxy plugin.

For jQuery, however, no automatic transport selection is possible. Instead, you must tell jQuery, either by default Ajax configuration, or per request, that you want to use 'flXHRproxy' as the transport. Once you do that, the URL matching described above will match up and find the appropriate configuration options for each flXHR enabled Ajax call.

So, for jQuery, you have two options for selecting the transport:

One-time default configuration setup: jQuery.ajaxSetup({transport:'flXHRproxy'});

-or-

per Ajax call: jQuery.ajax({..., transport:'flXHRproxy'});

_________________
Kyle Simpson
flensed Administrator
Getify Solutions, Inc.


May 19th, 2009, 8:49 am
Profile E-mail WWW
Site Admin

Joined: May 30th, 2008, 1:31 pm
Posts: 370
Location: Austin, TX
Post Re: Framework plugins ("flXHRproxy")
The new v1.1 of the jQuery flXHRproxy plugin fixes some "buggy" behavior. Specifically, now, if you don't have any matching registered options for an Ajax call, jQuery will fall back to native XHR rather than to a flXHR instance with default options.

_________________
Kyle Simpson
flensed Administrator
Getify Solutions, Inc.


June 2nd, 2009, 8:35 pm
Profile E-mail WWW
Site Admin

Joined: May 30th, 2008, 1:31 pm
Posts: 370
Location: Austin, TX
Post Mootools plugin added
Mootools now has a flXHRproxy plugin. It works pretty much identically to the other frameworks' plugins.

_________________
Kyle Simpson
flensed Administrator
Getify Solutions, Inc.


July 8th, 2009, 7:09 pm
Profile E-mail WWW
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF