Details
Description
In a typical JSF portlet, developers do the following in order to get PortletPreferences and PortletConfig:
Object requestObject = facesContext.getExternalContext().getRequest();
PortletRequest portletRequest = (PortletRequest) requestObject;
PortletPreferences portletPreferences = portletRequest.getPreferences();
However, the typcast is failing, because the facesContext.getExternalContext().getRequest() method is always returning an object of type ServletEnvironmentRequest.
And of course, ServletEnvironmentRequest does not have a getPreferences() method.
Object requestObject = facesContext.getExternalContext().getRequest();
PortletRequest portletRequest = (PortletRequest) requestObject;
PortletPreferences portletPreferences = portletRequest.getPreferences();
However, the typcast is failing, because the facesContext.getExternalContext().getRequest() method is always returning an object of type ServletEnvironmentRequest.
And of course, ServletEnvironmentRequest does not have a getPreferences() method.
Issue Links
- duplicates
-
ICE-1625 Make Portlet specific artifacts and APIs accessible to developers
-
- Closed
-
This issue is a specific instance of a more general problem so I am marking this as a duplicate of the parent case.