Using the Portlet API

In general, custom JSR-168-compliant portlets for SAS can be developed by using industry-standard Java classes. The com.sas.portal.portlet classes in the SAS API are specific to proprietary portlets and are not used with JSR 168 portlets.
However, a class that is specific to SAS is needed to obtain a user context for the portlet:
com.sas.web.keys.CommonKeys
defines common prefix strings and other keys used to prevent namespace collisions among various SAS domains.
The USER_CONTEXT field contains a string that can be used to obtain the user context for a portlet session.
In JSP code, you can obtain a user context directly from the HTTP session by using the following code fragments:
<%
import com.sas.services.user.UserContextInterface;
import com.sas.web.keys.CommonKeys;

UserContextInterface userContext =
   (UserContextInterface) session.getAttribute(CommonKeys.USER_CONTEXT);
%>
In Java code, you can obtain a user context from the portlet session by using the following code fragments:
import javax.portlet.*;
import com.sas.services.user.UserContextInterface;
import com.sas.web.keys.CommonKeys;

UserContextInterface userContext = (UserContextInterface) 
   portletRequest.getPortletSession().getAttribute(
      CommonKeys.USER_CONTEXT,
      PortletSession.APPLICATION_SCOPE);
The UserContextInterface enables you to access all of the user metadata from the SAS Metadata Repository. For more information, see http://support.sas.com/rnd/gendoc/bi92/api/Foundation/com/sas/services/user/UserContextInterface.html in the SAS API documentation.