Show TOC

Using CC/PP with PortletsLocate this document in the navigation structure

Context

The Composite Capability/Preference Profiles (CC/PP) is a specification used for providing capabilities and preferences to portal user agents.

For more information about CC/PP, refer to the JSR 188 specification.

SAP does not provide an implementation of this library. However, if you want to use it, you can do this as described below.

Procedure

  1. Obtain the library of CC/PP. For example, ccpp-1.0.jar . You can download it at http://jcp.org .
  2. Obtain an implementation of the library. For example, ccpp-impl.jar .
  3. Add the implementation and library JARs to the WEB-INF/lib directory of your Web application archive.
  4. Set the system property javax.ccpp.ProfileFactory value to the implementation-specific value of the profile factory, for example, to org.example.ccpp.CCPPProfileFactoryImpl .

    You can do this using the System.setProperties() method within the source code of the portlet implementation.

    Sample Code
                         public class RenderPortlet extends GenericPortlet {
            private static final String PROFILE_FACTORY = "javax.ccpp.ProfileFactory";
    
            @Override
            public void render(RenderRequest request, RenderResponse response)
                    throws PortletException, IOException {
                    PrintWriter out = response.getWriter();
                    Properties properties = System.getProperties();
                    properties.setProperty(PROFILE_FACTORY, "org.example.ccpp.CCPPProfileFactoryImpl");
                    System.setProperties(properties);
                    out.println(PROFILE_FACTORY + "=[" + System.getProperty(PROFILE_FACTORY) + "]" + "<br/>");
    
                    out.println(request.getAttribute(PortletRequest.CCPP_PROFILE));
            }
    }
    
                      

    If the setup is correct, the output of the example code is the following:

    Output Code
                         javax.ccpp.ProfileFactory=[org.example.ccpp.CCPPProfileFactoryImpl]
    org.example.ccpp.CCPPProfileFactoryImpl$ProfileImpl@11917c08