Site Network: Personal | Professional | Photography

Technical Blog

This blog will contain content related to Java, Seam, Security, my sites and projects, as well as other technical subjects I am interested in.

Comments and questions are welcome!

Updates to the ATG RSS Feed Module

Sunday, May 4th, 2008

Thanks to Doug Henderson sending me some code updates I have released a new version of the RSS Feed Droplet (first mentioned in this post) which supports configurable character encodings. This can be very useful if you have "interesting" characters in the content you are publishing.

I have also rolled the code into my ATG Open Source Module Pack, so that I can maintain everything in one location.

Also: please note that you cannot reformat the JSP code, or introduce any spaces as it will break the feed. I've made note of that in the module's Readme as well.

Enjoy!

ATG RSS Generator Droplet

Monday, August 13th, 2007

I sat down a few hours ago to start a droplet which would generate an RSS feed based on data in an ATG Repository. Surprisingly, I think I'm done.

Basically what it is is a droplet, which you put on an otherwise empty JSP page (it's important that there is no whitespace on the JSP as well). You configure the droplet via it's .properties file to point to a Repository, and you give it an item descriptor, which will be the primary item to use for the data in the feed. You then configure a bunch of mostly optional data points for the channel data of the RSS feed (this includes things like the main site link, the RSS feed title and description, and optional elements like author, copyright information, etc...

Then you provide the property names (and nested "." driven properties are okay here) for the various elements of the RSS Item like title, link, description, publish date, etc... Currently it sorts based on the publish date property, to provide items in newest-to-oldest order. I may support a separate sort property later on if people want one.

Since many repository items may not have a usable link property, you can pass in a itemLink property value with an embedded property (also supporting nested properties, and supporting the special repositoryId). For instance you can do this:

itemLink=/catalog/product.jsp?productId=#{repositoryId}

or even something like:

itemLink=http://#{author.homepageURL}?referrer=mySite

The JSP page, when hit, generates a nice RSS 2.0 compliant feed based on the data in the Repository.

You can also include the following in your <head> element of your site's main page to get the nice automatic feed discovery in many browsers:

<link href="http://mysite.com/rss.jsp" rel="alternate" type="application/rss+xml" title="RSS" />

You can download the entire package here. This includes the source, a heavily commented properties file, a jsp file, and a jar file to load into your classpath.

Some examples where you might want to use this: Blog, Newsletter, any site with updated content, a commerce site's catalog, discussion forums, etc.....

Enjoy!

ItemToXMLDroplet

Monday, August 6th, 2007

This is an extremely simple Droplet with source, a config file, and a sample JSP. All the droplet does it transform a passed-in RepositoryItem into XML and dump it out. It would be handy for vending data to client-side logic in JavaScript or Flash, when you don't want to write-up a full WebService.

You can download it all here.

The example JSP takes in a query parameter userId and generates the XML for the user profile with that id. For instance, if you call:

http://alita.local:8840/test/test.jsp?userId=930003

you get this......

(more...)