Gadgets and Widgets: Using Liferay as a Mashup Platform

Company Blogs May 6, 2009 By Alberto Montero Staff

The web has changed. You can call it Web 2.0, Web 3.0 or whatever you want but the truth is that websites are now more than ever interconected. Originally we had links, later came the ability to syndicate contents through feeds and some websites became an aggregation of many other sites, and now we are experiencing a proliferation of the so called mashups.

What is a mashup? It's a pretty generic word but we could define it as a page that combines data and functionality from other websites. As you can see this is a very similar definition of what can be said of a portal, so it was a natural fit for Liferay to end up providing the features need it to also use it as a Mashup Platform.

Converting a Liferay page into a mashup

There are many sites providing their contents as widgets/gadgets. Netvibes and iGoogle provides a lot of them, but there are others like sports newspapers, travel agencies, financial sites and others. You can now easily bring all those contents and applications to your Liferay-based portal.

Liferay includes two portlets to mashup content from iGoogle (google-gadget-portlet) and Netvibes (netvibes-widget-portlet). In the configuration tab you can browse all the widgets those platoforms offer. If you want to mashup content from other sites, you only need to choose the propper widget type and paste the URL. That's all.

portlet page with a widget and a gadget

Exporting portal functionality to allow for external mashups

So, let's say you want to gain visibility for your forums, or you want to make some documents publicly available, so you decide to publish them in iGoogle. May be you are the manager of a social website and want your news to be available from Facebook. Or you could have a corporative portal built using Liferay, and you want the CEO blog to be published in other, non-Liferay, internal sites. All those things are now possible.

The option to publish portlets in those platforms is available under the sharing tab in the configuration view of any portlet, and it is available out of the box to any portlet deployed in Liferay.

portlet shown in a facebook page

portlet shown in iGoogle pages

Tips for better mashup of your portlets

The portlet appearance and decoration is preserved when showing it as a widget. To maximize useful space, you may want to remove the portlet border from the look&feel option in Liferay.

When you publish a portlet as a gadget/widget you are not publishing a copy, but pointing to the application, so you always get the latest version. Due to this fact, the same security and visibility rules that apply for the portal, apply to widgets too. In certain scenarios is an advantage to doing RSS publishing, as you do not get a list of entries, but a fully functional application.

If you want to publish portlets, be aware that the target platform needs to reach the source machine, so if you are behind a router, you will need to propperly configure NAT or whatever other method you choose. If you select iGoogle, then you need to configure everything to run on port 80, as Google removes the port information in URLs when adding gadgets.


A portal platform is a perfect base for building a mashup platform and at Liferay we didn't want to loose this opportunity. In this post I've shown how you can use Liferay Portal to combine the power of both traditional portal techniques with the new ways of sharing data and functionality. By doing this it's possible to achieve a perfect combination of a controlled environment for things that need it while still leverage the external resources that the web (2.0) has to offer whenever it makes sense.

Have you started using this functionalities? If so, we'd love to hear more about how you are using it. Also, all your ideas and suggestions will be very welcome.

Several of the features that have been explained in this article have been developed as part of the Romulus project. You can get more information about this in the documents published in the Romulus ( project website here (

More scripting languages supported

Company Blogs July 21, 2008 By Alberto Montero Staff

Hi all.

Recently we have added support for python and javascript in the list of supported scripting languages. This is part of the results of the Romulus project ( With these additions now you can choose among 5 scripting languages to develop portlets (PHP, Ruby, Groovy, Python and Javascript).

A brief example on how to develop portlets was shown in another blog entry, and I have recently added a wiki entry to explain it in more detail ant to allow you to improve it.

Enjoy it!

Advanced form validation with scripting technologies

Company Blogs July 10, 2008 By Alberto Montero Staff

One of the goals of Romulus ( is to improve productivity of developers by allowing the use of scripting languages to develop certain task.

A point where scripting technologies can be very valuable is when performing form validation. The most common case is to allow the definition of regular expressions the field must match. While this is a good approach, it has limitations. How can you validate a name? How can you validate an address? How can you validate a given field is different from another? This kind of validations can not be done using regular expressions, and require Java coding in classes to be performed, thus it is not possible (or at least quite difficult) to user configurable validation of forms.

The idea is to use scripting technologies to allow the definition of the validation function when defining a form using Webform portlet. The chosen scripting language could be anyone of the currently supported by Liferay (PHP, Ruby, Groovy, Python and Javascript), but using Javascript has an additional benefit. With the appropiated transformation it could be possible to execute validation also in the client side (much like struts forms does).

Let's work on it!


Ruby, PHP and now ... ¡Groovy!

Company Blogs May 22, 2008 By Alberto Montero Staff

Hi everyone.

Yes, now you can develop portlets using groovy, and thanks to the last changes made by Brian is quite simple.

Let's take a look at sample-groovy-portlet (check it out from the plugins svn). The file structure is like this:

Sample groovy porlet directory structure

All the impotant files are under docroot/WEB-INF. There you can see usual files, including portlet.xml, which looks like this


In this file you can set up the portlet class (com.liferay.util.bridges.groovy.GroovyPortlet) and which files will handle several options. You can specify which groovy file will be invoked to process the action and which file will be used to render the different portlet modes (in this example only the view mode is defined, but you can easily imagine how to do it for edit and help modes). You can also define a list of files including common stuff under the 'global-files' init param. You can set as much files as you want.

From groovy files you can access the usual portlet objects, namely the request and response objects (actionRequest/actionResponse, renderRequest/renderResponse), portlet config (portletConfig), portlet context (portletContext), portlet preferences (portletPreferences) and user info (userInfo).

Just one final note. You need to include groovy.jar in the lib directory of every plugin you develop.

Now you only need to write your groovy code and deploy it (if you create the plugin with the plugins SDK everything will be much easier).

Enjoy it!

Improving WebForm

Company Blogs May 6, 2008 By Alberto Montero Staff

Currently, the WebForm portlet it quite simple. But it was designed to be as simple as possible. Now we have chances to improve it a bit.

After the development of the expandos (thanks Ray) the task of storing data with a variable model in a database is much more simple (incredible simple, I must say). You just need to create a table and iterate over the specified fields to add columns to your table, which are further referenced by its name. This way you can create a form as complex as you want and the backend is still quite simple.

The new web form will support other new features, as the possibility to export data in the database to a file (email and files on server are still supported). For the time being data is exported in csv format, but we may consider other formats in a near future.

Tasks in Romulus project

Company Blogs March 28, 2008 By Alberto Montero Staff

Hi all,

If you have read previous posts you already know about Romulus.

Liferay task are related to three areas:

  • Portal mashups
    • Mashups are about reusing. Why not reuse already provided portal functionality? Many portlets have a core functionality and a set of extras, such as rating, comments and others, that will be fine to just to reuse.
  • Server side scripting support
    • It is commonly agreed that scripting languages leverage better developer productivity, so having the posibility to develop in one of those scripting languages will be good.
  • Client side technologies
    • The posibilities of javascript clients are still emerging, but there already are impresive features. Romulus will research on different ways to adapt data presentation, different ways to adapt or improve functionalities and different to ways to create applications by combining preexistent functionalities. Of course, everytihg (or at least the most) from the client.

How could development in Liferay be improved?

Company Blogs March 13, 2008 By Alberto Montero Staff

Could development in Liferay be improved? The answer is allways yes. And, how could development be improved? This may have several answers, and one of them is Romulus.

Romulus is an R&D project funded by the European Union. The overall purpose of the project is to improve the productivity of developers of the Java platform (which has a huge installed base in Europe) by applying a variety of innovative ideas and techniques. The project involves a lot of research including evaluation of development technologies available (for Java and other platforms), determining the main pain points for developers, identifying areas where more productivity can be achieved, etc. It also includes the improvement of the two Open Source projects involved in Romulus, Roma and Liferay, to make it easier to develop for and with them.

Eurpean projects are carried out by consortiums of research labs and companies. Together with Liferay there are other 6 partners: Germinus (a Spanish company and project leader), AssetData, Imola (both Italian companies), Deri (an Irish reseach lab), UPM (the largest Spanish technical university) and ICI (a Romanian research institution).

What are Liferay's tasks? We are responsible for all the research related to portals as well as for all the development oriented to achieve maximum productivity when working with Liferay Portal in particular. The project developments will be made to allow faster portal app development through the use of scripting languages and frameworks, allowing the creation of client side applications (aka lifelets) and portal mashups (reusal of functionalities provided by the portal by portal applications), etc.

That's about it for now. For those interested please feel free to ask questions and offer ideas. There is a website of the project (developed with Liferay) available at

The first post

Company Blogs March 13, 2008 By Alberto Montero Staff


I'm Alberto Montero, one of the latest incorporations to Liferay staff.

Although sometime hard, it's allways exciting to start a new job,  with lots of new things to learn and to do.

My work here will be related to engineering, mainly inside the Romulus project, which aims to improve development in Liferay.  But if you want to know more, you will have to read the next post.

Blog best practices say that blog post should be short. So let's start in the good way.


Showing 8 results.
Items 20
of 1