<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Gridshore &#187; rome</title>
	<atom:link href="http://www.gridshore.nl/tag/rome/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gridshore.nl</link>
	<description>A weblog about software engineering, Architecture, Technology an other things we like.</description>
	<lastBuildDate>Tue, 13 Dec 2011 15:36:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Creating an rss feed using the latest features of Hippo</title>
		<link>http://www.gridshore.nl/2011/12/13/creating-an-rss-feed-using-the-latest-features-of-hippo/</link>
		<comments>http://www.gridshore.nl/2011/12/13/creating-an-rss-feed-using-the-latest-features-of-hippo/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 15:36:57 +0000</pubDate>
		<dc:creator>jettro</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[server technology]]></category>
		<category><![CDATA[hippo]]></category>
		<category><![CDATA[rome]]></category>

		<guid isPermaLink="false">http://www.gridshore.nl/?p=1216</guid>
		<description><![CDATA[<p>On my employers blog I wrote a piece about a new feature of Hippo called pipelines that can be used to create new content channels. We have created an rss feed using the standard components of Hippo combined with the Rome project. If you are interested you can read the blog post here:</p> <p>http://blog.dutchworks.nl/2011/12/13/embedding-rss-in-hippo-using-the-pipelines-feature/</p> ]]></description>
			<content:encoded><![CDATA[<p>On my employers blog I wrote a piece about a new feature of Hippo called pipelines that can be used to create new content channels. We have created an rss feed using the standard components of Hippo combined with the Rome project. If you are interested you can read the blog post here:</p>
<p><a href="http://blog.dutchworks.nl/2011/12/13/embedding-rss-in-hippo-using-the-pipelines-feature/">http://blog.dutchworks.nl/2011/12/13/embedding-rss-in-hippo-using-the-pipelines-feature/</a></p>
<div class='dd_post_share'><div class='dd_buttons'><div class='dd_button'><iframe src='http://widgets.dzone.com/links/widgets/zoneit.html?url=http%3A%2F%2Fwww.gridshore.nl%2F2011%2F12%2F13%2Fcreating-an-rss-feed-using-the-latest-features-of-hippo%2F&amp;title=Creating%20an%20rss%20feed%20using%20the%20latest%20features%20of%20Hippo&amp;t=2' height='25' width='155' frameborder='0' scrolling='no'></iframe></div></div><div style='clear:both'></div></div><!-- Social Buttons Generated by Digg Digg plugin v4.5.3.4, 
    Author : Yong Mook Kim
    Website : http://www.diggdigg2u.com -->]]></content:encoded>
			<wfw:commentRss>http://www.gridshore.nl/2011/12/13/creating-an-rss-feed-using-the-latest-features-of-hippo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a w3c validated rss feed using Rome and spring 3</title>
		<link>http://www.gridshore.nl/2010/02/16/creating-a-w3c-validated-rss-feed-using-rome-and-spring-3/</link>
		<comments>http://www.gridshore.nl/2010/02/16/creating-a-w3c-validated-rss-feed-using-rome-and-spring-3/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 11:16:00 +0000</pubDate>
		<dc:creator>jettro</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[rome]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[spring 3]]></category>
		<category><![CDATA[Spring Framework]]></category>
		<category><![CDATA[w3c]]></category>

		<guid isPermaLink="false">http://www.gridshore.nl/?p=999</guid>
		<description><![CDATA[<p> <p>For my current customer I had to create an rss feed. In the java domain you immediately grab Rome to do the job. There was a catch. My customer wants (with good reason) to have feeds validated by the w3c feed validator. This turned out to be a slightly more complicated job. Luckily [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.gridshore.nl/wp-content/uploads/romelogo-small.jpg" alt="romelogo-small.jpg" border="0" width="200" height="144" align="left" />
<p>For my current customer I had to create an rss feed. In the java domain you immediately grab <a href="https://rome.dev.java.net/">Rome</a> to do the job. There was a catch. My customer wants (with good reason) to have feeds validated by the <a href="http://validator.w3.org/feed/">w3c feed validator</a>. This turned out to be a slightly more complicated job. Luckily Rome has good support for extensions, so at least it was possible.</p>
<p>In this blog post I describe the challenges I had creating the validated feed. If you want more in depth information please check my post on my employers blog : <a href="http://blog.jteam.nl/2009/12/17/serving-a-heavy-load-rss-feed-with-spring-3-and-ehcache/">serving a heavy load rss feed with spring 3 and ehcache</a>.</p>
<p><span id="more-999"></span><br />
<h2>Rome extension</h2>
<p>At the moment I am missing the atom namespace in the resulting xml.</p>
<pre>
&lt;rss version="2.0" <strong>xmlns:atom="http://www.w3.org/2005/Atom</strong>"&gt;
</pre>
<p>I also miss the actual atom link:</p>
<pre>
&lt;atom:link href="http://dallas.example.com/rss.xml" rel="self" type="application/rss+xml" /&gt;
</pre>
<p>Now we must tell Rome how to generate this content. Rome supports a plugin structure. Detailed information can be found on this page:</p>
<p><a href="http://wiki.java.net/bin/view/Javawsxml/Rome05TutorialSampleModule">http://wiki.java.net/bin/view/Javawsxml/Rome05TutorialSampleModule</a></p>
<p>An extension consists of a module containing the data to be used by the extension, a generator if the extension needs to add items to the generated feed and a parser if the extension is about reading feeds. In my case I only need the module component and the generator. Finally you need to tell Rome about the extension, this is done in a configuration file that needs to be available on the classpath.</p>
<h3>Module</h3>
<p>The only data I need is the link for the atom element, the href. The module itself consists of an interface and an implementation. The interface defines the getters and setters. The implementation has a few additional methods. The following code block shows them both.</p>
<pre class="brush: java; title: ; notranslate">
public interface AtomNSModule extends Module {
    public static final String URI = &quot;http://www.w3.org/2005/Atom&quot;;
    String getLink();
    void setLink(String href);
}

public class AtomNSModuleImpl extends ModuleImpl implements AtomNSModule {
    private String link;

    public AtomNSModuleImpl() {
        super(AtomNSModule.class, URI);
    }

    public String getLink() {
        return link;
    }

    public void setLink(String link) {
        this.link = link;
    }

    public Class getInterface() {
        return AtomNSModule.class;
    }

    public void copyFrom(Object obj) {
        AtomNSModule module = (AtomNSModule) obj;
        module.setLink(this.link);
    }
}
</pre>
<p>The code is not to hard to understand. Concentrate on the <strong>copyForm</strong> method. Here we put the data from our model into the object that is used by the framework to extract data. This is why you need the interface as well.</p>
<h3>Generator</h3>
<p>Here we add the elements to the generated xml. JDom is used to generate xml from an object tree of Elements. The following code block shows the complete generator.</p>
<pre class="brush: java; title: ; notranslate">
public class AtomNSModuleGenerator implements ModuleGenerator {
    private static final Namespace ATOM_NS = Namespace.getNamespace(&quot;atom&quot;, AtomNSModule.URI);

    private static final Set NAMESPACES;

    static {
        Set nss = new HashSet();
        nss.add(ATOM_NS);
        NAMESPACES = Collections.unmodifiableSet(nss);
    }

    public String getNamespaceUri() {
        return AtomNSModule.URI;
    }

    public Set getNamespaces() {
        return NAMESPACES;
    }

    public void generate(Module module, Element element) {
        AtomNSModule atomNSModule = (AtomNSModule) module;
        Element root = element;
        while (root.getParent() != null &amp;&amp; root.getParent() instanceof Element) {
            root = (Element) element.getParent();
        }
        root.addNamespaceDeclaration(ATOM_NS);

        Element atomLink = new Element(&quot;link&quot;, ATOM_NS);
        atomLink.setAttribute(&quot;href&quot;, atomNSModule.getLink());
        atomLink.setAttribute(&quot;rel&quot;, &quot;self&quot;);
        atomLink.setAttribute(&quot;type&quot;, &quot;application/rss+xml&quot;);

        element.addContent(0, atomLink);
    }
}
</pre>
<p>Focus on the <strong>generate</strong> method. In this method we add the namespace declaration to the root element and we create a new element that is added to the provided element. The provided element is the channel element. The result of the feed now looks like this.</p>
<pre>
&lt;rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"&gt;
  &lt;channel&gt;
    &lt;atom:link href="http://localhost:8080/rss/nieuws.rss" rel="self" type="application/rss+xml" /&gt;
	...
  &lt;/channel&gt;
&lt;/rss&gt;
</pre>
<h3>Configuration</h3>
<p>The last part is telling Rome to use the new component. This is done by putting a rome.properties file on the classpath with the following contents.</p>
<pre>
rss_2.0.feed.ModuleGenerator.classes=nl.gridshore.rss.romeextension.AtomNSModuleGenerator
</pre>
<p>It is important to specify the rss_2.0 because multiple generators are available and this is the one that is used.</p>
<h2>Encoding &#8211; response type</h2>
<p>Another problem I had had to do with encoding. You can set the type of encoding in the generated xml, but the response of the spring controller/view combination does not follow this. Therefore you have to set the encoding of the response object explicitly. In the view component I added the following lines of code:</p>
<pre class="brush: java; title: ; notranslate">
    @Override
    protected void prepareResponse(HttpServletRequest request, HttpServletResponse response) {
        super.prepareResponse(request, response);
        response.setCharacterEncoding(CharacterEncodingConstants.UTF8);
    }
</pre>
<p>I hope this can help others to create better feeds as well, suggestions for improvements are of course welcome.</p>
<div class='dd_post_share'><div class='dd_buttons'><div class='dd_button'><iframe src='http://widgets.dzone.com/links/widgets/zoneit.html?url=http%3A%2F%2Fwww.gridshore.nl%2F2010%2F02%2F16%2Fcreating-a-w3c-validated-rss-feed-using-rome-and-spring-3%2F&amp;title=Creating%20a%20w3c%20validated%20rss%20feed%20using%20Rome%20and%20spring%203&amp;t=2' height='25' width='155' frameborder='0' scrolling='no'></iframe></div></div><div style='clear:both'></div></div><!-- Social Buttons Generated by Digg Digg plugin v4.5.3.4, 
    Author : Yong Mook Kim
    Website : http://www.diggdigg2u.com -->]]></content:encoded>
			<wfw:commentRss>http://www.gridshore.nl/2010/02/16/creating-a-w3c-validated-rss-feed-using-rome-and-spring-3/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>My first source contribution to springframework</title>
		<link>http://www.gridshore.nl/2008/11/18/my-first-source-contribution-to-springframework/</link>
		<comments>http://www.gridshore.nl/2008/11/18/my-first-source-contribution-to-springframework/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 20:05:13 +0000</pubDate>
		<dc:creator>jettro</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[rome]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[spring framework]]></category>

		<guid isPermaLink="false">http://www.gridshore.nl/?p=459</guid>
		<description><![CDATA[<p>I have reached a new Milestone. More than three years ago I blogged about a framework called Rome. This is a framework that enables you to create Rss feeds without to much hassle. I found the framework and created a base class that was put into springmodules. This blogpost Creating-an-rss-feed-with-spring-and-Rome explains what I have [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.gridshore.nl/wp-content/uploads/picture-4.png" alt="Picture 4.png" border="0" width="124" height="53" align="left" />I have reached a new Milestone. More than three years ago I blogged about a framework called <a href="https://rome.dev.java.net/">Rome</a>. This is a framework that enables you to create Rss feeds without to much hassle. I found the framework and created a base class that was put into springmodules. This blogpost <a href="http://www.gridshore.nl/blog/index.php?/archives/5-Creating-an-rss-feed-with-spring-and-Rome.html">Creating-an-rss-feed-with-spring-and-Rome</a> explains what I have done.</p>
<p>A few weeks a go I was at Denmark and I talked to Arjen Poutsma. He told me my classes were going to be used in the springframework. Looking back at these classes they have been changed a lot. Still I am proud to have made a contribution to a framework that is used so often.</p>
<p>When you are going to use Springframework version 3, have a look at these classes:</p>
<ul>
<li>org.springframework.web.servlet.view.feed.AbstractAtomFeedView</li>
<li>org.springframework.web.servlet.view.feed.AbstractRssFeedView</li>
<li>org.springframework.web.servlet.view.feed.AbstractFeedView</li>
</ul>
<p>See you next time &#8230;</p>
<div class='dd_post_share'><div class='dd_buttons'><div class='dd_button'><iframe src='http://widgets.dzone.com/links/widgets/zoneit.html?url=http%3A%2F%2Fwww.gridshore.nl%2F2008%2F11%2F18%2Fmy-first-source-contribution-to-springframework%2F&amp;title=My%20first%20source%20contribution%20to%20springframework&amp;t=2' height='25' width='155' frameborder='0' scrolling='no'></iframe></div></div><div style='clear:both'></div></div><!-- Social Buttons Generated by Digg Digg plugin v4.5.3.4, 
    Author : Yong Mook Kim
    Website : http://www.diggdigg2u.com -->]]></content:encoded>
			<wfw:commentRss>http://www.gridshore.nl/2008/11/18/my-first-source-contribution-to-springframework/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

