NewsfeedCreator released

August 10, 2005 – 12:00 am

In the last few years RSS-Newsfeeds became more popular. Nearly every well-known website (Heise.de, Spiegel.de, BBC.com, CNN.com) provides its news in an XML based format for syndication.

NewsfeedCreator is a small framework for providing news from within a JAVA based Web Application. As a developer you have just to subclass de.koop.util.newsfeed.AbstractNewsfeedServlet and implement the createNewsfeed(...) method, e.g:


import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import de.koop.util.newsfeed.AbstractNewsfeedServlet;

public class MyFeedServlet extends AbstractNewsfeedServlet {

/* (non-Javadoc)
* @see de.koop.util.rss.AbstractNewsfeedServlet#
* createNewsfeed(javax.servlet.http.HttpServletRequest)
*/
public Newsfeed createNewsfeed(HttpServletRequest request) {

Newsfeed news = new Newsfeed();

news.setTitle( "Koop News" );
news.setDescription( "News by Andreas Koop" );
news.setLink( "http://www.multikoop.de/" );

// Optional
FeedImage image = new FeedImage();
image.setTitle( "Koop Logo" );
image.setUrl( "http://www.multikoop.de/gfx/logo.gif" );
image.setLink( "http://www.multikoop.de/" );
image.setDescription( "Feed provided by multikoop.de. Click to visit.");

news.setImage( image );

// get your news items from somewhere, e.g. your database
// and put them as follows to the newsfeed
FeedItem item = new FeedItem();
item.setTitle( "Koops NewsfeedCreator 1.0a released" );
item.setLink( "http://www.multikoop.de/news.do?id=1234" );
item.setDescription( "Koops NewsfeedCreator 1.0a has been released.\n" +
"Generate easily RSS0.91, RSS2.0 Newsfeeds." +
" Further formats still awaiting to be implemented." );
item.setDate( new Date() );
item.setAuthor( "Andreas Koop" );

news.addItem( item );

return news;
}

}

And the corresponding configuration in your Application Descriptor, e.g web.xml:


<servlet>
<servlet-name>newsfeed</servlet-name>
<servlet-class>MyFeedServlet</font></servlet-class>
<init-param>
<param-name>format</param-name>
<param-value>RSS2.0</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>newsfeed</servlet-name>
<url-pattern>*.rss</url-pattern>
</servlet-mapping>

After restarting your application server just provide a link to http://host/context/somename.rss within your website.

Version 1.0a:05-22-2004: Generation of RSS0.91 and RSS2.0.

Download [Binaries], [Sources].

  1. 3 Responses to “NewsfeedCreator released”

  2. kostenfrei habt ihr empfangen, kostenfrei gebt - math.10:8

    deshalb vielen dank fuer deine grosse muehe und vorallem fuer diese nette ueberraschung die bibel fuers handy kostenfrei im netz zu finden - doll :-)

    es waere schoen wenn es auch andere bibeluebersetzungen gaebe wie z.b. die gute nachricht oder die neuewelt uebersetzung. zeige doch anderen wie es geht eine mobilbibel zu machen. kein buch ist wichtiger als gottes wort.

    vielen dank

    jens

    By Jens on Dec 20, 2005

  3. Danke für deine Mühen. War schon lange auf der Suche noch einer Handy Bibel! Benutze ein SE K500i und es funktionniert einwandfrei.

    Viele Grüße

    Elmar

    By Elmar on Nov 21, 2006

  4. Ich finds supertoll was du gemacht hast :-)

    Endlich immer meine BIbel dabei

    Super klasse

    ChriX

    By Christoph on Dec 17, 2006

Post a Comment