Skip to end of metadata
Go to start of metadata

Making a portlet remotable

Only JSR-286 (Portlet 2.0) portlets can be made remotable as the mechanism to expose a portlet to WSRP relies on a JSR-286-only functionality.

GateIn does NOT, by default, expose local portlets for consumption by remote WSRP consumers. In order to make a portlet remotely available, it must be made "remotable" by marking it as such in the associated portlet.xml. This is accomplished by using a specific org.gatein.pc.remotable container-runtime-option. Setting its value to true makes the portlet available for the remote consumption, while setting its value to false will not publish it remotely. As specifying the remotable status for a portlet is optional, you do not need to do anything if you do not need your portlet to be available remotely.

"BasicPortlet" portlet is specified as being remotable

It is also possible to specify that all the portlets declared within a given portlet application to be remotable by default. This is done by specifying container-runtime-option at the portlet-app element level. Individual portlets can override that value to not be remotely exposed.

In the example above, two portlets are defined. The org.gatein.pc.remotable container-runtime-option is set to true at the portlet-app level, meaning that all portlets defined in this particular portlet application are exposed remotely by GateIn's WSRP producer. Note, however, that it is possible to override the default behavior: specifying a value for the org.gatein.pc.remotable container-runtime-option at the portlet level will take precedence over the default. In the example above, RemotelyExposedPortlet inherits the remotable status defined at the portlet-app level since it does not specify a value for the org.gatein.pc.remotable container-runtime-option. NotRemotelyExposedPortlet, however, overrides the default behavior and is not remotely exposed. Note that in the absence of a top-level org.gatein.pc.remotable container-runtime-option value set to true, portlets are NOT remotely exposed.

Make portlets aware of WSRP requests

WSRP sets the org.gatein.invocation.fromWSRP (defined by the org.gatein.wsrp.WSRPConstants.FROM_WSRP_ATTRIBUTE_NAME constant) request attribute to Boolean.TRUE when the request initiated from WSRP. A portlet can therefore check whether a request is coming from WSRP and react specifically if so required, as follows:

Checking whether a request is issued from WSRP inside a portlet
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Sep 11, 2013

    New content on making portlets aware of WSRP requests is added to Enterprise docs for Jpp6.1 GA.

    Administration and Configuration guide -> Chapter 24 Web Services for Remote Portlets.