ICEfaces
  1. ICEfaces
  2. ICE-1625

Make Portlet specific artifacts and APIs accessible to developers

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.6
    • Fix Version/s: 1.7DR#1, 1.7
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      Portlets
    • Affects:
      Documentation (User Guide, Ref. Guide, etc.), Compatibility/Configuration

      Description

      Due to the fact that we dispatch calls from MainPortlet -> MainServlet, the resulting portlet specific artifacts (like request, response, etc.) are wrapped to look like servlet artifacts and certain types and APIs that are specific to portlets are not available to the developer.

        Issue Links

          Activity

          Hide
          Deryk Sinotte added a comment -

          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().

          Show
          Deryk Sinotte added a comment - 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().
          Hide
          Deryk Sinotte added a comment -

          This hack doesn't seem to work well due to the intricacies of the JSF lifecycle. We need to sit down and decide how we want to do this properly for 1.6.

          Show
          Deryk Sinotte added a comment - This hack doesn't seem to work well due to the intricacies of the JSF lifecycle. We need to sit down and decide how we want to do this properly for 1.6.
          Hide
          Neil Griffin added a comment -

          Deryk,

          Attached is is a simplified version of the PortletArtifactHack.java file that should do me well until you guys reach 1.7.

          Thanks,

          Neil

          Show
          Neil Griffin added a comment - Deryk, Attached is is a simplified version of the PortletArtifactHack.java file that should do me well until you guys reach 1.7. Thanks, Neil
          Hide
          Deryk Sinotte added a comment -

          I've checked in the supplied file so that it will be there for the 1.6 release.

          Show
          Deryk Sinotte added a comment - I've checked in the supplied file so that it will be there for the 1.6 release.
          Hide
          Deryk Sinotte added a comment -

          Marking as FIXED for 1.6. The current solution is completely temporary. A more comprehensive solution is required for the 1.7 release. A new case will be opened for that work.

          Show
          Deryk Sinotte added a comment - Marking as FIXED for 1.6. The current solution is completely temporary. A more comprehensive solution is required for the 1.7 release. A new case will be opened for that work.

            People

            • Assignee:
              Unassigned
              Reporter:
              Deryk Sinotte
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: