Moving Existing Custom Portlets to SAS Information Delivery Portal 4.2 |
Logoff Portlet Action |
The logoff portlet action allows the Web application associated with the remote portlet to receive notification when a user logs off the portal. This allows resources to be cleaned up immediately, as opposed to waiting for an HttpSession time-out. To implement, the portlet.xml file must contain a logoff action like the following:
</portlet-action> <portlet-action name="logoff" remote-logoff="true"> <url>http://host-name:8080/SASRemotePortlet/Controller</url> </portlet-action>
The following code in the remote portlet Web application processes the logoff action:
// Check for logoff notification before doing anything else. if (RemotePortletToolkitUtil.isLogoffRequest(request)) { session.invalidate(); return false; }
RemotePortletToolkitUtil Classes |
The com.sas.portal.portlet.remote.RemotePortletToolkitUtil class contains the following new utility methods that make it easier to write remote portlets:
A convenience routine that returns the portlet action targeted to the current portlet instance:
static String getAction(HttpServletRequest request, RemotePortletContext context)
The portlet action is defined in the portlet.xml file. If the request is targeted to another portlet instance or the page is refreshing, it returns RemotePortletToolkitUtil.PAGE_REFRESH_ACTION.
A convenience routine that returns the portlet ID for the current portlet:
static String getPortletId(HttpServletRequest request)
Because the portlet ID is unique per portlet instance, this provides a mechanism for allowing multiple portlet instances on a page,
A convenience routine to retrieve the RemotePortletContext for the portlet:
static RemotePortletContext getRemotePortletContext(HttpServletRequest request)
A convenience routine that checks for a logoff notification:
static boolean isLogoffRequest(HttpServletRequest request)
This call should be made before processing the request. Multiple portlet instances can have information stored in the HttpSession, but the logoff request is processed only once. Use an HttpSessionBindingListener if resources need to be cleaned up when the session is invalidated.
A convenience routine that returns true if the request was targeted to the current portlet instance:
static boolean isPortletRequest(HttpServletRequest request)
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.