Atom Publishing Plugin

Introduction #

The Goal of this Web Plugin is to expose a subset of Liferay Portal's services using AtomPub to allow for the creation of read-write mashups. These mashups can read data from the portal and also interact with it by creating or modifying existing content.

Blogs and the Web Content have been integrated within the AtomPub web plugin, but every entity that has been built with Liferay Service Builder can be easily integrated as well. This web allows an AtomPub client (which may be part of a Mashup) to list blog entries or web content, create new blogs/web content and update or remove existing blogs/web content.

The “AtomPub web plugin” provides the following URL which can be used to browse the available workspaces and collections. It is also possible to use a regular browser, such as Firefox, to read the list of blog entries. For example given the following blog entries created through Liferay Portal UI:

These blogs can also be obtained as an Atom feed using the following URL:

 http://localhost:8080/atompub-web/atom/blogs?companyId=10111&groupId=10130 

Which Firefox is able to interpret and show as in the following screenshot:

Using the atompub-web plugin #

To test the atompub-web plugin, we'll first need a REST Client. You can download a free REST Client by downloading the REST Client GUI here: http://code.google.com/p/rest-client/downloads/list

Right click the downloaded jar and run the application by opening it with Java(TM) Platform SE Binary.

As an example lets add a new Blog Entry using the REST Client GUI.

URL: http://localhost:8080/atompub-web/atom/blogs?companyId=1&groupId=18

For the Method tab

Select POST for the HTTP Method

For the Body tab

Body Content Type: Select "application/atom+xml" for Content-type Select UTF-8 for Content

And add this text In the text box

<?xml version='1.0'?>

<entry xmlns='http://www.w3.org/2005/Atom'>
  <title>Atom Pub Blog 1</title>
  <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
  <updated>2003-12-13T18:30:02Z</updated>
  <author><name>Joe Bloggs</name></author>
  <content>Hello world!</content>
</entry>

For the Auth tab:

Select BASIC for Auth Type.

And enter your Liferay Portal screenname and password.

Now clicking the green arrows creates a new blog entry!

For a list of Blogs, we could use the following URL:

http://localhost:8080/atompub-web/atom/blogs?companyId=1&groupId=18 

The browser is using the GET HTTP method to obtain a list of all blog entries, but it's also possible to use the other three main HTTP methods, POST, PUT and DELETE, to add new entries, update them and delete them directly. The screenshot shows in the lower side the resulting HTTP headers including the etag headers which allows for conditional GETs for very high scalability.

You can also select to view a specific blog entry by using this URL where 11017 is the ID of the blog entry:

 http://localhost:8080/atompub-web/atom/blogs/11017?companyId=10111&groupId=10130 

Using this same tool we can also test updating the entry using a PUT. The following screenshot shows how the body of the PUT request is an XML text with the entry details in Atom format. The server answers with 204 HTTP return code to specify that the entry has been updated correctly.

For Web Content, replace "/blogs/" with "/web_content/" in the URLs.

An AtomPub client can also be implemented in JavaScript, which becomes a very useful component for building read-write mashups.

jQuery.ajax({
   type: "POST",
   url: 'http://localhost:8080/atompub-web/atom/blogs?companyId=10111&groupId=10135',
   username: 'test',
   password: 'test',
   processData: false,
   contentType: 'application/atom+xml',
   dataType: "xml",
   data: body,
   cache: false,
   success: function(msg){
      callback.onSuccess('conseguido');
   },
   error: function (msg){
   callback.onFailure();
   }
});

Security #

Basic authentication has been implemented for this plugin, so you may need to introduce your credentials for some actions. The userName can be your screenName, your emailAddress or your userId in your Liferay Portal.

7 Attachments
20383 Views
Average (0 Votes)
The average rating is 0.0 stars out of 5.
Comments
Threaded Replies Author Date
I am interested to know more about the status... Orin Fink May 27, 2010 7:22 AM
Very interesting. Good news that Liferay can do... Kaon . Z June 27, 2010 11:51 PM
I'd also like to know about the status of this... Jakub Liska October 8, 2010 2:43 PM
Hi Jakub, The Atom Publishing Plugin is in... Jorge Ferrer October 26, 2010 2:26 AM
Jorge, Is this plugin part of the supported... sreek samudrala July 24, 2014 10:56 PM
Hey Sreek, I'm sorry to say that it's not and... Jorge Ferrer August 4, 2014 3:29 PM

I am interested to know more about the status of this plugin. It looks like its been removed from the SVN trunk but possibly put into the core in some other fashion. If it is, what is the new URL to utilize when publishing to Liferay over the REST interface for AtomPub?
Posted on 5/27/10 7:22 AM.
Very interesting. Good news that Liferay can do it.

I am considering to use REST API to integrate my web portal with mobile portal. One content, multiple channels...
Posted on 6/27/10 11:51 PM.
I'd also like to know about the status of this plugin. This is really useful plugin, AtomPub is promising technology/protocol and could be very well used for many more things in liferay than just blogging. Look at Google data API. Please don't give up on this plugin.
Posted on 10/8/10 2:43 PM.
Hi Jakub,

The Atom Publishing Plugin is in incubation status and as far as I know it works. We have plans to make it a supported plugin soon.
Posted on 10/26/10 2:26 AM in reply to Jakub Liska.
Jorge,
Is this plugin part of the supported plugin now? OR this no longer makes sense with new Liferay portal release.
Posted on 7/24/14 10:56 PM in reply to Jorge Ferrer.
Hey Sreek,

I'm sorry to say that it's not and will probably never be in its current form. I was expecting much more interest in it, but we had almost zero feedback about it.

Looking forward I think that maybe it makes more sense to come up with a sort of (RESTful) API Builder that developers can use to easily and quickly build a customized API for their liferay-based systems. But so far it's just an idea.
Posted on 8/4/14 3:29 PM in reply to sreek samudrala.