Adding a Portlet

This page describes how to add a custom portlet to the WSRP provider portlet installed by WSRP4J.

  1. Install the portlet into Pluto - The Pluto Installation page gives guidance on how to install custom portlets. I've found the easiest way is to use the admin portlet, and feed it a war which contains no web.xml file, allowing Pluto to create its own. The admin portlet also takes care of modifying all the necessary pluto configuration files. After the portlet is installed, you will probably need to restart your application server.

  2. Tell the WSRP portlet about the new portlet - The WSRP portlet needs a copy of the portlet registry entry from Pluto. From the webapps directory of your application server, usually $TOMCAT_HOME/webapps, copy the portlet registration from pluto/WEB-INF/data/portletentityregistry.xml into wsrp/WEB-INF/data/portletentityregistry.xml For example, a hello world portlet installed on a fresh copy of Pluto might look like this:

        <application id="6">
            <portlet id="0">
    After this portlet has been configured, you might need to restart your application server.
  3. (optional) Tell the test Swing consumer about the new portlet - If you want to view the new portlet through the WSRP4J-provided Swing consumer driver, you will need to modify and create several crypticly-named files.

    1. Declare the portlet - You will need to create a file in persistence/portlets that will tell the Swing consumer about the new portlet. First, note the application and portlet id from step 2. Then, from the driver/SwingConsumer directory, copy an existing portlet config file:

      • persistence/portlets/org.apache.wsrp4j.consumer.driver.WSRPPortletImpl\@WSRP4J_0_1.xml to

      • persistence/portlets/org.apache.wsrp4j.consumer.driver.WSRPPortletImpl\@WSRP4J_APPID_PORTLETID.xml

    • where APPID is the application id and PORTLETID is the portlet id. Then, edit your new file to insert your portlet information. For example, using the portlet definition above, the persistence/portlets/org.apache.wsrp4j.consumer.driver.WSRPPortletImpl\@WSRP4J_6_0.xml include this:

    1. Add the portlet to the page - To have the portlet be displayed by the Swing consumer client, you need to configure where on the page it will be shown. Edit the persistence/pages/ file and add an entry for your portlet. For example, the above example portlet would require this addition:

          <portlet-key xmlns:xsi="" xsi:type="java:org.apache.wsrp4j.consumer.driver.PortletKeyImpl">
  4. Finished! If you completed step 3, you should be able to run the Swing consumer driver and see your new portlet.

WSRP4J/AddPortlet (last edited 2009-09-20 23:46:19 by localhost)