How to Use an Existing Portlet Application ?

Introduction

eXo Portal supports standard Portlet API: JSR 168 and JSR 286, this means you can develop your own portlet and deploy them into eXo Portal, but also this means that you can use any existing portlet compliant with these specification.

This article explains the steps to package, deploy and use a portlet in eXo Portal 2.x, the steps are:

  1. Configuring the Web Application to have eXo Portlet Container register the portlets
  2. Deploying your application
  3. Refresh the eXo Portal Application Registry
  4. Use the Portlet

Instructions

1. Configuring the Web Application to have eXo Portlet Container register the portlets

The Portlet API defines the deployment descriptor, the portlet.xml file, that contains the "description" and "configuration" of the portlets. However the specification does not define how the portlet are registered and recognized by the portals where it will be use. Each portal software has its own way of doing, using often proprietary XML file. eXo is a big supporter of standard and always tries to avoid proprietary file, so the way you define the integration point between the Portal/Portlet Container and the Portlet application is using some standard servler and servlet listener entry in the web.xml.

So the first step to prepare the deployment of a portlet application is to modify the web.xml (this could be done after the deployment also, depending of your application server), to add the following entry:

<?xml version="1.0" encoding="UTF-8"?>

<web-app>
...
<servlet>
<servlet-name>PortletWrapper</servlet-name>
<servlet-class>org.exoplatform.services.portletcontainer.impl.servlet.ServletWrapper</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>PortletWrapper</servlet-name>
<url-pattern>/PortletWrapper</url-pattern>
</servlet-mapping>

<listener>
<listener-class>org.exoplatform.services.portletcontainer.impl.servlet.PortletApplicationListener</listener-class>
</listener>
...
</web-app>

You can now save the file and repackage your Web application (WAR file). Note that you can in some application server use for example a deployment plan (JSR-88) to add this information during deployment without having to access the archived file directly.

2. Deploy the application in your application server

Your application is now ready to be deployed in your application server. This operation is specific to the application server that you are using in your environment. Depending of your container the logs will change, but let's see what Apache Tomcat is showing to us in its console when we are deploying our portlet application:

...
INFO: Deploying web application archive GooglePortlet.war
...
2008/07/25 15:33:58:476 CEST (INFO) portletcontainer - DEPLOYING PORTLET APPLICATION: GooglePortlet
2008/07/25 15:33:58:522 CEST (INFO) portletcontainer - The portlet.xml file valid portlet spec 1
2008/07/25 15:33:58:522 CEST (INFO) portletcontainer - -- read: 1 portlets
2008/07/25 15:33:58:524 CEST (INFO) portletcontainer - DEPLOYED PORTLET APPLICATION: GooglePortlet
...

As you can see the application is first deployed in the Web Container, and then the portlets are deployed and registered in the eXo Portlet Container.

You can now go in eXo Portal to first refresh your reposiroty and then use the portlet.

3. Refresh the eXo Application Registry

As administrator, or any authorized user, go to the Application Registry to refresh it using the following actions:

exo-menu.png

Then update the registry by clicking on the "Import Portlet" button.

app-registry-01.png

Your application registry contains now your new portlet that can be drop on a Page or use in WebOS.

Summary

In this article you have learned how to deploy a portlet in eXo Portal.

 
Navigation

Creator: Tugdual GRALL on 2008/07/24 08:50
Copyright (c) 2000-2009. Allright reserved - eXo platform SAS
1.6.13286