com.ibm.portal.state.service
Interface PortletStateManagerService

All Superinterfaces:
AccessorFactory, PortletService

public interface PortletStateManagerService
extends PortletService, AccessorFactory

Portlet service which allows for creating URLs that cannot be created via the JSR 168 API. This service also provides access to the current state of the portlet window calling this service.
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 "portletservice/com.ibm.portal.state.service.PortletStateManagerService".
Coding example for accessing the state manager from within a standard portlet:

       PortletServiceHome psh;
       javax.naming.Context ctx = new javax.naming.InitialContext();
       try {
            psh = (PortletServiceHome) 
               ctx.lookup("portletservice/com.ibm.portal.state.service.PortletStateManagerService");
       } catch(javax.naming.NameNotFoundException ex) {
            ... error handling ...
       }
       ...
       // use the service
       PortletStateManagerService service = (PortletStateManagerService) psh.getPortletService(PortletStateManagerService.class);
       // get the portlet state manager for the current request
       PortletStateManager manager = service.getPortletStateManager(request, response);
       // create URLs etc.
       ...
       // dispose the portlet state manager as we do not need it any longer
       manager.dispose();
 
The returned PortletServiceHome object is valid for the lifetime of the portal. It is recommended to perform the JNDI lookup in the init method of the portlet and store the PortletServiceHome object home in an instance variable. That also applies to the actual PortletStateManagerService.
Note that it is not permitted to access references to the PortletStateManager or PortletStateManagerController longer than one request. These objects must be retrieved from the PortletStateManagerService object whenever they are used in another request. Also note that the PortletStateManager as well as the PortletStateManagerController are 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 dispose() method must be invoked.

Since:
6.0

Field Summary
static java.lang.String JNDI_NAME
          the JNDI name for this service
 
Method Summary
 PortletStateManager getPortletStateManager(javax.portlet.PortletRequest request, javax.portlet.PortletResponse response)
          Get a portlet state manager for the current request and response.
 PortletStateManagerController getPortletStateManagerController(javax.portlet.ActionRequest request, javax.portlet.ActionResponse response)
          Get a portlet state manager for the current request.
 PortletStateManagerController getPortletStateManagerController(javax.portlet.EventRequest request, javax.portlet.EventResponse response)
          Get a portlet state manager for the current request.
 
Methods inherited from interface com.ibm.portal.state.accessors.AccessorFactory
compact
 

Field Detail

JNDI_NAME

static final java.lang.String JNDI_NAME
the JNDI name for this service

See Also:
Constant Field Values
Method Detail

getPortletStateManager

PortletStateManager getPortletStateManager(javax.portlet.PortletRequest request,
                                           javax.portlet.PortletResponse response)
                                           throws StateManagerException
Get a portlet state manager for the current request and response.

Parameters:
request - The current portlet request. Must not be null.
response - The current portlet response. Must not be null.
Returns:
A state manager for accessing the state of the current portlet window.
Throws:
StateManagerException - thrown if the initialization of the PortletStateManager fails.

getPortletStateManagerController

PortletStateManagerController getPortletStateManagerController(javax.portlet.ActionRequest request,
                                                               javax.portlet.ActionResponse response)
                                                               throws StateManagerException
Get a portlet state manager for the current request.

Parameters:
request - The current portlet action request. Must not be null.
response - The current portlet action response. Must not be null.
Returns:
A state manager for accessing and modifying the state of the current portlet window.
Throws:
StateManagerException - thrown if the initialization of the PortletStateManagerController fails.

getPortletStateManagerController

PortletStateManagerController getPortletStateManagerController(javax.portlet.EventRequest request,
                                                               javax.portlet.EventResponse response)
                                                               throws StateManagerException
Get a portlet state manager for the current request.

Parameters:
request - The current portlet event request. Must not be null.
response - The current portlet event response. Must not be null.
Returns:
A state manager for accessing and modifying the state of the current portlet window.
Throws:
StateManagerException - thrown if the initialization of the PortletStateManagerController fails.
Since:
7.0