Interface MVCResourceCommand

All Superinterfaces:
MVCCommand
All Known Implementing Classes:
BaseMVCResourceCommand, BaseRSSMVCResourceCommand, BaseTransactionalMVCResourceCommand

public interface MVCResourceCommand extends MVCCommand
Provides an interface to allow the portlet to serve a resource. This interface can only be used when the portlet is based on MVCPortlet.

The resource command to be invoked is determined by two factors:

  • The portlet name that the resource URL is referring to.
  • The ResourceID of the resource request.

Implementations of this interface must be OSGi components that are registered in the OSGi Registry with the following properties:

  • javax.portlet.name: The portlet name associated to this resource command.
  • mvc.command.name: the command name that matches the ResourceID of the resource request. This name cannot contain any comma (,).

The method MVCPortlet.serveResource(ResourceRequest, ResourceResponse) searches the OSGi Registry for the resource command that matches both the resource request's portlet name with the property javax.portlet.name and the resource request's ResourceID with the property mvc.command.name.

In general, only one resource command is executed per portlet resource URL. If the ResourceID of the resource request is, however, a comma separated list of multiple names, MVCPortlet finds the resource commands and invokes them sequentially in the order they're specified in the list.

When there are multiple resource commands registered for the same portlet name and with the same command name, only the resource command with the highest service ranking is invoked.

BaseMVCResourceCommand is an abstract class that implements this interface and can be extended to simplify using resource commands.

Author:
Sergio González
  • Field Details

  • Method Details

    • serveResource

      boolean serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws PortletException
      Invoked by MVCPortlet to allow the portlet to serve a resource.
      Parameters:
      resourceRequest - the resource request
      resourceResponse - the resource response
      Returns:
      true if an error occurs in serving the resource; false otherwise
      Throws:
      PortletException