com.ibm.portal.resolver.friendly.service
Interface PortletFriendlySelectionServiceHome
- All Superinterfaces:
- FriendlySelectionServiceHome, PortletService
public interface PortletFriendlySelectionServiceHome
- extends FriendlySelectionServiceHome, PortletService
Portlet service which allows for working with friendly URLs.
The portlet service is accessed by a JNDI lookup; the lookup returns an
implementation of this interface, which allows to get the actual portlet
service under the JNDI name JNDI_NAME
.
Coding example for accessing the service from within a Java Standard Portlet:
PortletServiceHome psh;
javax.naming.Context ctx = new javax.naming.InitialContext();
try {
psh = (PortletServiceHome)
ctx.lookup("portletservice/com.ibm.portal.resolver.friendly.service.PortletFriendlySelectionServiceHome");
} catch(javax.naming.NameNotFoundException ex) {
... error handling ...
}
...
// use the service
PortletFriendlySelectionServiceHome service = (PortletFriendlySelectionServiceHome) psh.getPortletService(PortletFriendlySelectionServiceHome.class);
// get the service for the current request
PortletFriendlySelectionService selSvc = service.getSelectionService(request, response);
// create URLs etc.
...
// dispose the service as we do not need it any longer
selSvc.dispose();
The returned PortletServiceHome
object is valid for the lifetime of
the portal. It is recommended to perform the JNDI lookup in the
Portlet.init(PortletConfig)
method of the portlet and store the
PortletServiceHome
object home in an instance variable. That also
applies to the actual PortletPocServiceHome
.
Note that it is not permitted to access references to the PortletFriendlySelectionService
longer than one request. These objects must be retrieved from the
PortletServiceHome
object whenever they are used in another request.
Also note that the PortletServiceHome
is derived fron the
Disposable
interface, i.e. whenever these objects are not
needed any longer (at the end of a request at the latest) their Disposable.dispose()
method must be invoked.
- Since:
- 6.1.0
Field Summary |
static java.lang.String |
JNDI_NAME
Name that can be used for the JNDI lookup of this service |
JNDI_NAME
static final java.lang.String JNDI_NAME
- Name that can be used for the JNDI lookup of this service
getPortletFriendlySelectionService
PortletFriendlySelectionService getPortletFriendlySelectionService(javax.portlet.PortletRequest request,
javax.portlet.PortletResponse response)
throws ModelException,
StateException
- Retrieves an instance of the friendly selection service. This service needs to be
disposed after retrieval
- Parameters:
request
- the current portlet requestresponse
- the current portlet response
- Returns:
- an instance of the selection service
- Throws:
ModelException
- -
if the navigation model could not be accessed
StateException
- -
if the state could not be accessed