Wicket and RSS Feeds

Ryan Sonnek bio photo By Ryan Sonnek

I love Wicket, and I love RSS so it’s only logical that I’d find a way to serve up RSS within Wicket.  There’s an example RssPage posted on the Wicket wiki, and I posted a simple RSS solution a while back, but neither of these are really solid solutions.  For the past few weeks I’ve been working heavily with serving RSS feeds, and I’ve finally gotten to a point where I can provide something back to the Wicket community.

Introducing, the new and improved Wicket FeedPage.  It’s actually the same API as my previous solution, but the inner workings are much improved.  To create an RSS feed, just create a subclass of FeedPage and follow the ROME API to create a SyndFeed for your RSS (or Atom) content.

public class ItemFeedPage extends FeedPage {
 protected SyndFeed getFeed() {
   SyndFeed feed = new SyndFeedImpl();
   feed.setTitle("Sample Feed");
   feed.setDescription("Sample Feed for how cool Wicket is");

   List entries = new ArrayList();
   SyndEntry entry = new SyndEntryImpl();
   entry.setTitle("Article One");
   entry.setPublishedDate(new Date());

   SyndContent description = new SyndContentImpl();
   description.setValue("Article descriping how cool wicket is.");

   return feed;

The ROME library has really impressed me and does an excellent job of hiding the internals of creating these feeds.  Want to change from RSS to Atom?  Simple!  Just change this line:


to this


As Borat would say…“Very Nice!”

I’ve created a new Wicket Stuff project to host this project which should make it super easy to get up and going.  Just add this block to your pom.xml file:

    <name>Wicket-Stuff Repository</name>


As a side note, if you’re having difficulty creating a dynamic url for use in your feed (guid, return url, etc) vote for this Wicket issue to help create a new API for that info.