java.lang.ClassNotFoundException: int is seen in the SystemOut.log while executing a visibility rule that uses an Application object.

The ClassNotfoundException is being caused by the use of an application object that is of type int. Personalization supports only java classes and this feature has been added through the ifix PM03285. Contact IBM support to obtain this ifix.

How to get the sessionID off the RequestContext object that is passed to the init() method in the ApplicationObject?

Call a method getRequestObject(). This is implemented through com.ibm.websphere.personalization.context.PersonalizationContext.
That will return a com.ibm.websphere.personalization.PznRequestObjectInterface which can be used to access various attributes.

If the interface is an Http type (com.ibm.websphere.personalization.PznHttpRequestObjectInterface), you should call getServletRequest.
If the type is portlet (com.ibm.websphere.personalization.PznPortletRequestObjectInterface), then you will need to call getPortletRequest.

In the ApplicationObject class there is public void init(RequestContext context) method and the com.ibm.websphere.personalization.RequestContext object. How do we access the PortletRequest object and from there the User object.

If you need to access an attribute on the user in a rule, you could create a condition in the rule to access the included portal user collection.
If it’s necessary to access the user outside of the included portal user collection to do some processing on that value, then the user object can be accessed from the RequestContext object by calling get(“pzn.user./.personalization/collections/ibmpzn:wpsUser”)

There is no public API way to access the underlying PortletRequest.

 

Posted in Faqs