I checked in a very, very temporary mechanism for accessing portlet artifacts and APIs for this release. This should not be relied upon in any way, shape, or form in future releases.
To access the PortletRequest, PortletConfig, and their associated APIs, you can do the following:
First, you need to get an attribute from the request that was placed there before the dispatch:
FacesContext fc = FacesContext.getCurrentInstance();
ExternalContext ec = fc.getExternalContext();
HttpServletRequest req = (HttpServletRequest)ec.getRequest();
Object obj = req.getAttribute(PortletArtifactHack.PORTLET_HACK_KEY);
The resulting object is an instance of PortletArtifactHack but it implements both PortletRequest and PortletConfig interfaces so you can cast it in any one of the following three ways depending on your requirements.
PortletArtifactHack hack = (PortletArtifactHack)obj;
PortletRequest portletRequest = (PortletRequest)obj;
PortletConfig portletConfig = (PortletConfig)obj;
Many of the methods throw UnsupportedOperationException()s. I've only exposed a few things that people need right away, like getPreferences().
I checked in a very, very temporary mechanism for accessing portlet artifacts and APIs for this release. This should not be relied upon in any way, shape, or form in future releases.
To access the PortletRequest, PortletConfig, and their associated APIs, you can do the following:
First, you need to get an attribute from the request that was placed there before the dispatch:
FacesContext fc = FacesContext.getCurrentInstance();
ExternalContext ec = fc.getExternalContext();
HttpServletRequest req = (HttpServletRequest)ec.getRequest();
Object obj = req.getAttribute(PortletArtifactHack.PORTLET_HACK_KEY);
The resulting object is an instance of PortletArtifactHack but it implements both PortletRequest and PortletConfig interfaces so you can cast it in any one of the following three ways depending on your requirements.
PortletArtifactHack hack = (PortletArtifactHack)obj;
PortletRequest portletRequest = (PortletRequest)obj;
PortletConfig portletConfig = (PortletConfig)obj;
Many of the methods throw UnsupportedOperationException()s. I've only exposed a few things that people need right away, like getPreferences().