Posted in ColdFusion | Posted on 11-02-2007 | 2,750 views
Adobe's Share service doesn't have RSS feeds yet (as far as I know), but there is no reason you can't role your own! Here is a quick example.
The first piece is ShareCFC, my open source wrapper for the Share service. Grab the bits - get the required logon bits, and then create an instance:
2
3<cfset appkey = "harrypotter">
4<cfset sharedsecret = "parishiltonisactuallyreallysmart">
5
6<cfif not isDefined("application.share")>
7 <cfset application.share = createObject("component", "share").init("ray@camdenfamily.com","password-noreally",appkey,sharedsecret)>
8</cfif>
The initial logon to the Share service can be a bit slow so the cache here is important. Next we grab the files. Now the Share service is still in development and currently has some performance issues (like Lindsey has drinking issues), but I've been assured this will be fixed soon. For my testing I cached the results. To get all of my Share files it is one simple CFC call:
2 <cfset application.files = application.share.list()>
3</cfif>
4<cfset files = application.files>
I copied from the application scope to save myself some typing. So far so good? We don't want to create an RSS feed that points to items that folks can't use, so let's filter out the non-public stuff (and maybe this is a good idea to add to my code):
2<cfquery name="files" dbtype="query">
3select *
4from files
5where sharelevel = 'public'
6</cfquery>
Last but not least - lets make the feed. I create a column map to define columns to CFFEED required items, and create a struct of metadata:
2<cfset cmap.publisheddate = "createddate">
3<cfset cmap.title = "name">
4<cfset cmap.rsslink = "recipienturl">
5
6<cfset meta = structNew()>
7<cfset meta.title = "My Public Share Files">
8<cfset meta.description = "All of my public files from Share">
9<cfset meta.link = "http://www.coldfusionjedi.com">
10<cfset meta.version = "rss_2.0">
And finally - serve up the RSS:
2 columnMap="#cmap#" xmlVar="feedXML">
3
4<cfcontent type="text/xml" reset="true"><cfoutput>#feedxml#</cfoutput>
Easy peasy, lemon squeezy as my son would say. I see two potential things I can add to ShareCFC now - an optional share level filter to List(), and perhaps an automatic way to return the data in the RSS form.
I've saved my RSS here: feed://www.coldfusionjedi.com/demos/test.xml


<link rel="alternate" type="application/rss+xml" title="RSS" href="http://feeds.feedburner.com/RaymondCamdensColdfusi...; />
IE7 recognizes it.
As for page not found - not sure what to say. That's a valid URL.