Nowadays, an almost standard feature of web applications is to provide RSS feeds, irrespective of whether it is for a blog or some location-based service. Most clients can handle RSS out of the box. The Play examples only carry an example with hand crafted RSS feeds around. This example shows how to use a library for automatic RSS feed generation by getting the newest 20 post entities and rendering it either as RSS, RSS 2.0 or Atom feed.
You can find the source code of this example in the chapter2/render-rss
directory.
As this recipe makes use of the ROME library to generate RSS feeds, you need to download ROME and its dependency JDOM first. You can use the Play dependency management feature again. Put this in your conf/dependencies.yml
:
require: - play - net.java.dev.rome -> rome 1.0.0
Now as usual a test comes first:
public classFeedTest extends FunctionalTest { @Test public void testThatRss10Works() throws...