RIFE logo
This page last changed on Jul 09, 2006 by koreth.

RSS 2.0 and Atom 0.3 are natively supported and can be generated in real-time. The data can be provided in a streaming fashion, which makes the memory footprint very low.

To provide feed entries, you have to implement the EntryProvider interface.

For example:

public class DemoEntryProvider implements EntryProvider
{
    private Calendar mCalendar = null;
    
    public DemoEntryProvider()
    {
        mCalendar = GregorianCalendar.getInstance();
        mCalendar.set(2005, Calendar.JANUARY, 1, 0, 0, 0);
        mCalendar.set(Calendar.AM_PM, Calendar.AM);
    }
    
    public Feed getFeedDescriptor(ElementSupport element)
    {
        Feed feed = new Feed();
        feed
            .title("feed_title")
            .author("feed_author")
            .copyright("feed_copyright")
            .description("feed_description")
            .language("feed_language")
            .link("feed_link")
            .publishedDate(mCalendar.getTime());
        
        return feed;
    }
    
    public void provideEntries(ElementSupport element, EntryProcessor processor)
    {
        for (int i = 0; i < 10; i++)
        {
            mCalendar.set(Calendar.HOUR, i+1);
            Entry entry = new Entry();
            entry
                .author("entry_author"+(i+1))
                .content("entry_content"+(i+1))
                .link("entry_link"+(i+1))
                .publishedDate(mCalendar.getTime())
                .title("entry_title"+(i+1));
            
            processor.setEntry(entry);
        }
    }
}

All that's now left to do is to register an element in your site structure that is aware of this EntryProvider, like this for example:

<element file="rife/feed/feedprovider.xml" id="RSS" url="/rss">
    <property name="feedtype">rss_2.0</property>
    <property name="classname">my.pakkage.DemoEntryProvider</property>
</element>
Document generated by Confluence on Oct 19, 2010 14:56