public interface MVCResourceCommand extends MVCCommand
MVCPortlet
.
The resource command to be invoked is determined by two factors:
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.
Modifier and Type | Field and Description |
---|---|
static MVCResourceCommand |
EMPTY |
Modifier and Type | Method and Description |
---|---|
boolean |
serveResource(ResourceRequest resourceRequest,
ResourceResponse resourceResponse)
Invoked by
MVCPortlet to allow the portlet to serve a resource. |
static final MVCResourceCommand EMPTY
boolean serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws PortletException
MVCPortlet
to allow the portlet to serve a resource.resourceRequest
- the resource requestresourceResponse
- the resource responsetrue
if an error occurs in serving the resource;
false
otherwisePortletException