Monday, September 22, 2008

Writing a Simple Atompub Client Using Apache Abdera

The atom publishing protocol (similar to RSS but with an enhanced ability) is an application level protocol for editing and publishing web resources for periodically updated web sites, using HTTP. An atom document which adheres to the Atom syndication format spec, is used as an atom feed or entry.

Apache Abdera implements this protocol and exposes a simple API to make the thing easy. The way to create an atom feed and to add an entry is shown below.
Abdera abdera = new Abdera();
Feed fd = abdera.newFeed();

fd.setId("unique feed id");
fd.setTitle("feed title");
fd.setUpdated(new Date());

//adding the entry
Entry entry = fd.addEntry();
entry.setId("unique id");
entry.setTitle("entry title");
entry.setContent("The content goes here");
entry.addSimpleExtension(new QName(namespace, "elementName"), "elementContent");//To add an extra element to the entry
entry.setUpdated(new Date());
Now let's see how to post this feed to the abdera server which contains all business logic.
AbderaClient client = new AbderaClient(abdera);
ClientResponse response ="",fd);
Retrieving feeds is just a matter of calling Abdera client's get method.
ClientResponse response = client.get("");
Document doc = response.getDocument();
Abdera client can call put, delete methods as well. Meanwhile the server side should implement the relevant business logic for these methods.This is a good tutorial with further information to follow.


Marion Palmer said...
This comment has been removed by the author.
Charles Sorensen said...

As per the contract of the IETF's Atom Publishing Format and Protocol Working Group, the Atom Publishing Protocol is intended for the essential use instance of distributed and administration of weblog passages. It ought to shock no one, then, that numerous blogging programming suppliers, for example, Google, SixApart, and Roller have as of now taken off preparatory backing for the convention.

write my paper for cheap

asim said...

Try make happy client of your best dissertation writing service or anything else. Because it will let him come again to you for same thing that will increase your earning so make him happy as possible.

Related Posts with Thumbnails