Creating Portlet Providers

Follow these steps to create your own Portlet Provider:

  1. Create an OSGi module.

  2. Create a PortletProvider class in your module. Use the recommended class naming convention:

    [Entity] + [Action] + PortletProvider

    For example, here’s a Portlet Provider class for viewing a LanguageEntry:


  3. Extend BasePortletProvider if you want to use its getPortletURL method implementations.

  4. Implement one or more PortletProvider subinterfaces that match your action(s):

  5. Make the class an OSGi Component by adding an annotation like this one:

        immediate = true,
        property = {
        service = {INTERFACE_1.class, ...}

    The immediate = true element specifies that the component should be activated immediately upon installation.

    Assign to the property the fully qualified class name of the entity the portlet operates on. Here’s an example property for the WikiPage entity:


    Assign the service element to the PortletProvider subinterface(s) you’re implementing (e.g., ViewPortletProvider.class, BrowsePortletProvider.class, etc.). This example sets service to EditPortletProvider.class:

    service = EditPortletProvider.class
  6. If you’re overriding an existing Portlet Provider, rank your Portlet Provider higher by specifying a service.ranking:Integer property with a higher integer value:

    property = {
  7. Implement the provider methods you want. Be sure to implement the PortletProvider method getPortletName. If you didn’t extend BasePortletProvider, implement PortletProvider’s getPortletURL methods too.

  8. Deploy your module.

Now your Portlet Provider is available to return the ID and URL of the portlet that provides the desired behaviors. For more information on this, see Retrieving Portlets.

Portlet Providers

Retrieving Portlets

« Introduction to Back-end FrameworksRetrieving Portlets »
¿Fue útil este artículo?
Usuarios a los que les pareció útil: 0 de 0