ICEfaces
  1. ICEfaces
  2. ICE-4826

DataExporter uses API that is not functional in portlets

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.1
    • Fix Version/s: 1.8.2-RC1, 1.8.2
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      portlets dataexporter

      Description

      In the DataExporter.createFile method, the following logic is used:

              ServletContext context = ((HttpSession) FacesContext
                      .getCurrentInstance().getExternalContext().getSession(false))
                      .getServletContext();

      Casting to an HttpSession and attempting to retrieve the ServletContext will not work in portlets. In this case, the context is used to access the getRealPath() API to determine the location in the filesystem for storing/reading documents. The Portlet API also makes this available via the PortletContext. The code would need to look something like this:

              PortletContext pContext = ((PortletSession) FacesContext
                      .getCurrentInstance().getExternalContext().getSession(false))
                      .getPortletContext();

      There is no JSF way to do this that will work in both environments unfortunately so we'll need to ensure that this is done in a way that doesn't require a runtime dependency on the portlet.jar as it will not be available in plain web-apps.

        Issue Links

          Activity

          Deryk Sinotte created issue -
          Deryk Sinotte made changes -
          Field Original Value New Value
          Assignee Ken Fyten [ ken.fyten ]
          Hide
          Ken Fyten added a comment -

          Please correct, you'll need to implement using reflection to avoid runtime dependencies on portlet APIs in a none-portlet environment.

          Show
          Ken Fyten added a comment - Please correct, you'll need to implement using reflection to avoid runtime dependencies on portlet APIs in a none-portlet environment.
          Ken Fyten made changes -
          Salesforce Case []
          Fix Version/s 1.8.2 [ 10190 ]
          Assignee Priority P2
          Assignee Ken Fyten [ ken.fyten ] Adnan Durrani [ adnan.durrani ]
          Ken Fyten made changes -
          Salesforce Case []
          Affects [Compatibility/Configuration]
          Hide
          Mark Collette added a comment -

          Perhaps the core should provide the half-dozen or so methods, common to ServletContext and PortletContext, that ICEfaces may use, as an API, that would hide this detail.

          Show
          Mark Collette added a comment - Perhaps the core should provide the half-dozen or so methods, common to ServletContext and PortletContext, that ICEfaces may use, as an API, that would hide this detail.
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #19188 Mon Aug 24 08:41:37 MDT 2009 adnan.durrani Fix for ICE-4826 (DataExporter uses API that is not functional in portlets )
          Files Changed
          Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/util/CoreUtils.java
          Commit graph MODIFY /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/dataexporter/DataExporter.java
          Adnan Durrani made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          Hide
          Adnan Durrani added a comment -

          Fixed:
          Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\dataexporter\DataExporter.java
          Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\util\CoreUtils.java
          Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\util\CoreUtils.java
          Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\dataexporter\DataExporter.java
          Completed: At revision: 19188

          Show
          Adnan Durrani added a comment - Fixed: Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\dataexporter\DataExporter.java Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\util\CoreUtils.java Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\util\CoreUtils.java Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\dataexporter\DataExporter.java Completed: At revision: 19188
          Adnan Durrani made changes -
          Status In Progress [ 3 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Hide
          Adnan Durrani added a comment -

          Following static method added to the CoreUtils. It uses reflection to invoke getRealPath either on ServletContext or PorletContext based on the environment.

          com.icesoft.faces.util.CoreUtils.getRealPath(FacesContext facesContext, String path);

          Show
          Adnan Durrani added a comment - Following static method added to the CoreUtils. It uses reflection to invoke getRealPath either on ServletContext or PorletContext based on the environment. com.icesoft.faces.util.CoreUtils.getRealPath(FacesContext facesContext, String path);
          Hide
          Joanne Bai added a comment -

          Adnan, has dataExporter example been included in component showcase portlets version (ossrepo\icefaces\trunk\icefaces\samples\component-showcase\portlets)? I added it to the portlet.xml file in the conf directory, but still cannot see it showing as an available portlet on Liferay-tomcat6 and Jboss Portal 2.7.1. What else can we use for testing dataExporter portlet if not using component showcase? Thanks

          Show
          Joanne Bai added a comment - Adnan, has dataExporter example been included in component showcase portlets version (ossrepo\icefaces\trunk\icefaces\samples\component-showcase\portlets)? I added it to the portlet.xml file in the conf directory, but still cannot see it showing as an available portlet on Liferay-tomcat6 and Jboss Portal 2.7.1. What else can we use for testing dataExporter portlet if not using component showcase? Thanks
          Adnan Durrani made changes -
          Link This issue blocks ICE-4367 [ ICE-4367 ]
          Ken Fyten made changes -
          Issue Type Bug [ 1 ] Improvement [ 4 ]
          Salesforce Case []
          Ken Fyten made changes -
          Fix Version/s 1.8.2-RC1 [ 10210 ]
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #20024 Fri Dec 18 11:36:35 MST 2009 adnan.durrani 1.8.2EE DataExporter changes moved to Compat DataExporter towards ICE-4481. The changes include the fix of following JIRAs ICE-4484, ICE-4390, ICE-4660, ICE-4223, ICE-4823, ICE-4836, ICE-4837, ICE-4764, ICE-4730, ICE-4844, ICE-4289, ICE-4826, ICE-4863, ICE-4934, ICE-4955
          Files Changed
          Commit graph MODIFY /icefaces/scratchpads/glimmer/compat/component-metadata/src/main/resources/conf/ice_cust_properties/cust-dataExporter-props.xml
          Commit graph MODIFY /icefaces/scratchpads/glimmer/compat/core/src/main/resources/META-INF/resources/ice-extras.js
          Commit graph MODIFY /icefaces/scratchpads/glimmer/compat/samples/component-showcase/web/WEB-INF/includes/examples/custom/dataTable-dataExporter.xhtml
          Commit graph MODIFY /icefaces/scratchpads/glimmer/compat/components/src/main/java/com/icesoft/faces/component/dataexporter/DataExporter.java
          Commit graph MODIFY /icefaces/scratchpads/glimmer/compat/components/src/main/java/com/icesoft/faces/component/dataexporter/DataExporterRenderer.java
          Commit graph MODIFY /icefaces/scratchpads/glimmer/compat/core/src/main/java/com/icesoft/faces/util/CoreUtils.java
          Ken Fyten made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Assignee Priority P2

            People

            • Assignee:
              Adnan Durrani
              Reporter:
              Deryk Sinotte
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: