Adding A Portlet to the Registry

In order for Jetspeed to know about your portlet class, two things must happen:

1. Put your class in the classpath.

2. Add a reference to your portlet to Jetspeed's Portlet Registry.

The Jetspeed Portlet Registry contains the definitions of all portlets known to Jetspeed.

We've already completed both steps for you when you built and deployed the examples for tutorial 5. The example class files are copied to the Jetspeed web application's class directory. This is normally where classes specific to your web application are placed (under /WEB-INF/classes).

Secondly, a registry fragment file was created and deployed. See the source:


Registry fragments contain portlet definitions. Any file in the /WEB-INF/conf directory that has the xreg extension is included in the Jetspeed Registry. Here is what a registry entry looks like for our example:

<?xml version="1.0" encoding="UTF-8"?>
    <portlet-entry name="HelloWorld" hidden="false" type="instance" application="false">
            <description>Portlet How To Example 1 Hello World</description>
        <media-type ref="html"/>

We won't cover all the registry syntax here, but its important to give it a name, enter the class name correctly, and limit the media-type entry to only the media types that you will support. In our example, we only support HTML.