Welcome to WebProNews Breaking eBusiness and Search News
Advertise | Newsletter | Sitemap | News Feeds News Feed 
 WebProNews Search Part of the iEntry network iEntry inc. 

Return Format For ColdFusion Components In ColdFusion 8

Raymond Camden
Expert Author
Published: 2007-07-11

WebProNews RSS Feed


One of the lesser publicized updates in ColdFusion 8 is the introduction of the returnFormat attribute for the cffunction tag.

What does this do? ColdFusion Components, when executed remotely, will return data wrapped in WDDX format. This is a problem if you want to use the result in AJAX or some other non-WDDX form. ColdFusion 7 fixed this partially by making any function that had a returnType of XML return it's data unformatted.

ColdFusion 8 takes this further and allows you to explicitly state how the result data should be returned. You can specify:
* WDDX

* JSON

* plain
As you can probably guess, the "plain" format will do nothing to your result at all. This will only work if your data is a simple value. There is no such thing as a "plain" result for arrays.

What's interesting is that you can set the returnformat on the fly when you make a request. Imagine that you've requested:

http://localhost/foo.cfc?method=transform

The default behavior will be the same as what you saw in ColdFusion 7. If the returntype isn't XML, you get WDDX. But now you can change this with the request:

http://localhost/foo.cfc?method=transform&returnFormat=JSON

This will return the same data, but encoded in JSON instead of WDDX. This URL,

http://localhost/foo.cfc?method=transform&returnFormat=plain

Will return the data as is - not encoded at all. An interesting use of this would be a service that lets you embed an ad or other "widget". I could build a "Ray's Daily Tip" service that could be embeddable with a CFHTTP call.

Comments

View All Articles by Raymond Camden



Receive Our Daily Email of Breaking eBusiness News


About the Author:
Raymond Camden, ray@camdenfamily.com
http://ray.camdenfamily.com

Raymond Camden is Vice President of Technology for roundpeg, Inc. A long time ColdFusion user, Raymond has worked on numerous ColdFusion books and is the creator of many of the most popular ColdFusion community web sites. He is an Adobe Community Expert, user group manager, and the proud father of three little bundles of joy.

WebProNews RSS Feed

More Expert Articles Articles

Contact WebProNews
Advertisement





TOP NEWS

WebProBlog
The official blog of WebProNews.

Go to WebProBlog

Targeted Information for Business
WebProNews is part of the iEntry network

Internet Business: Marketing: Small Business:
WebProNews MarketingNewz SmallBusinessNewz
WebProWorld AdvertisingDay PromoteNews
EcommNewz SalesNewz EntrepreneurNewz

Software: Search Engines: Web Design:
WebMasterFree Jayde B2B DesignNewz
NetworkingFiles SearchZA FlashNewz
SecurityConfig SearchNewz WebSiteNotes

Developer: IT Management: Security:
DevWebPro ITManagement SecurityProNews
DevNewz SysAdminNews SecurityConfig
TheDevWeb NetworkingFiles NetworkNewz

The iEntry Network consists of over 100 web publications reaching millions of Internet Professionals. Contact us to advertise.
eBUSINESS RESOURCES






 Advertise | Contact Us | Corporate | Newsletter | Sitemap | Submit an Article | News Feeds
 WebProNews is an iEntry, Inc. ® publication - $line) { echo $line ; } ?> All Rights Reserved
WebProWorld
Ten most recent posts.


SearchBrains.com
NetworkingFiles
Featured Software


About WebProNews
WebProNews is the number one source for eBusiness News. Over 5 million eBusiness professionals read WebProNews and other iEntry business and tech publications.

WebProNews provides real-time coverage of internet business.

Free Email Newsletters:
WebProNews SearchNewz
WebProWorld DevWebPro
Marketing SecurityNews
Plus over 100 other newsletters!

Send me relevant info on products and services.


iEntry.com WebProWorld RSS Feed WebProWorld Contact WebProNews Print Version Email a friend Bookmark us SearchBrains.com SearchBrains RSS Feed