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());
fd.addAuthor("username");

//adding the entry
Entry entry = fd.addEntry();
entry.setId("unique id");
entry.setTitle("entry title");
entry.setSummary("summary");
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 = client.post("http://www.somesite.com/collection",fd);
Retrieving feeds is just a matter of calling Abdera client's get method.
ClientResponse response = client.get("http://www.somesite.com/collection/atom1.php");
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.


5 comments:

Unknown said...
This comment has been removed by the author.
laustan 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.

sheshaez said...

Clicking Here dig this our website Balenciaga Dolabuy click to read more my latest blog post

Anonymous said...

t2c72b8k14 r9x01n4g53 p7g35r9r95 t8c43x5t23 l5y36n1m31 t1y31v7q54

Related Posts with Thumbnails