ICEfaces
  1. ICEfaces
  2. ICE-10973

Remove the FileEntryUpload.setPortletRequestWrapper(Object) method

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: EE-3.3.0.GA_P03, 4.1
    • Fix Version/s: 4.1.1, EE-3.3.0.GA_P04
    • Component/s: ACE-Components
    • Labels:
      None
    • Environment:
      Portlets
    • Assignee Priority:
      P1

      Description

      The FileEntryUpload.setPortletRequestWrapper(Object) method should be removed for the following reasons:

      1) Calling BridgeContext.getCurrentInstance().setPortletRequest(PortletRequest) reflectively may have been necessary years ago with older versions of the bridge, but isn't anymore. Instead, the simple call to ExternalContext.setRequest(Object) (which FileEntryUpload.java is doing on line 212) is enough.

      2) The BridgeContext.setPortletRequest(PortletRequest) method has been removed from the Liferay Faces Bridge API. For more information see https://issues.liferay.com/browse/FACES-2611

        Activity

        Neil Griffin created issue -
        Ken Fyten made changes -
        Field Original Value New Value
        Assignee Mircea Toma [ mircea.toma ]
        Fix Version/s 4.1.1 [ 12972 ]
        Assignee Priority P1 [ 10010 ]
        Hide
        Mircea Toma added a comment -

        1) I tried running icefaces4-portlet test case with the modified version of FileEntryUpload class where the call to BridgeContext.getCurrentInstance().setPortletRequest(PortletRequest) was removed. Unfortunately there's an exception thrown in Liferay Bridge:

        19:44:58,925 ERROR [ExceptionHandlerAjaxImpl:70] com.liferay.faces.bridge.filter.liferay.internal.ResourceRequestBridgeLiferayImpl cannot be cast to javax.servlet.http.HttpServletRequest
        java.lang.ClassCastException: com.liferay.faces.bridge.filter.liferay.internal.ResourceRequestBridgeLiferayImpl cannot be cast to javax.servlet.http.HttpServletRequest
        	at org.icefaces.ace.component.fileentry.FileEntryUpload.afterPhase(FileEntryUpload.java:210)
        	at com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:189)
        	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:107)
        	at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:123)
        	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
        	at com.liferay.faces.bridge.internal.BridgePhaseResourceImpl.execute(BridgePhaseResourceImpl.java:276)
        	at com.liferay.faces.bridge.internal.BridgeImpl.doFacesRequest(BridgeImpl.java:150)
        	at javax.portlet.faces.GenericFacesPortlet.serveResource(GenericFacesPortlet.java:183)
        	at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:122)
        	at com.liferay.portlet.ScriptDataPortletFilter.doFilter(ScriptDataPortletFilter.java:84)
        	at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:116)
        	at com.liferay.portlet.CheckboxParametersPortletFilter.doFilter(CheckboxParametersPortletFilter.java:94)
        	at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:116)
        	at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:71)
        	at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:113)
        	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
        	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
        	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
        	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:119)
        	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:115)
        	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
        	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:719)
        	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:465)
        	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:390)
        	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:317)
        	at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:522)
        	at com.liferay.portlet.InvokerPortletImpl.invokeResource(InvokerPortletImpl.java:625)
        	at com.liferay.portlet.InvokerPortletImpl.serveResource(InvokerPortletImpl.java:462)
        	at com.liferay.monitoring.web.portlet.MonitoringInvokerPortlet.serveResource(MonitoringInvokerPortlet.java:302)
        	at com.liferay.portlet.PortletContainerImpl._doServeResource(PortletContainerImpl.java:803)
        	at com.liferay.portlet.PortletContainerImpl.serveResource(PortletContainerImpl.java:158)
        	at com.liferay.portlet.SecurityPortletContainerWrapper.serveResource(SecurityPortletContainerWrapper.java:151)
        	at com.liferay.portlet.RestrictPortletContainerWrapper.serveResource(RestrictPortletContainerWrapper.java:166)
        	at com.liferay.portal.kernel.portlet.PortletContainerUtil.serveResource(PortletContainerUtil.java:163)
        .....
        

        2) Debugging the same test case I can see that the BridgeContext.setPortletRequest method is reflectively acquired, without errors. So the method is still there.

        I used liferay-portal-7.0-ce-b7 for testing.

        Show
        Mircea Toma added a comment - 1) I tried running icefaces4-portlet test case with the modified version of FileEntryUpload class where the call to BridgeContext.getCurrentInstance().setPortletRequest(PortletRequest) was removed. Unfortunately there's an exception thrown in Liferay Bridge: 19:44:58,925 ERROR [ExceptionHandlerAjaxImpl:70] com.liferay.faces.bridge.filter.liferay.internal.ResourceRequestBridgeLiferayImpl cannot be cast to javax.servlet.http.HttpServletRequest java.lang.ClassCastException: com.liferay.faces.bridge.filter.liferay.internal.ResourceRequestBridgeLiferayImpl cannot be cast to javax.servlet.http.HttpServletRequest at org.icefaces.ace.component.fileentry.FileEntryUpload.afterPhase(FileEntryUpload.java:210) at com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:189) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:107) at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:123) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198) at com.liferay.faces.bridge.internal.BridgePhaseResourceImpl.execute(BridgePhaseResourceImpl.java:276) at com.liferay.faces.bridge.internal.BridgeImpl.doFacesRequest(BridgeImpl.java:150) at javax.portlet.faces.GenericFacesPortlet.serveResource(GenericFacesPortlet.java:183) at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:122) at com.liferay.portlet.ScriptDataPortletFilter.doFilter(ScriptDataPortletFilter.java:84) at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:116) at com.liferay.portlet.CheckboxParametersPortletFilter.doFilter(CheckboxParametersPortletFilter.java:94) at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:116) at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:71) at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:113) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:119) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:115) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:719) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:465) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:390) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:317) at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:522) at com.liferay.portlet.InvokerPortletImpl.invokeResource(InvokerPortletImpl.java:625) at com.liferay.portlet.InvokerPortletImpl.serveResource(InvokerPortletImpl.java:462) at com.liferay.monitoring.web.portlet.MonitoringInvokerPortlet.serveResource(MonitoringInvokerPortlet.java:302) at com.liferay.portlet.PortletContainerImpl._doServeResource(PortletContainerImpl.java:803) at com.liferay.portlet.PortletContainerImpl.serveResource(PortletContainerImpl.java:158) at com.liferay.portlet.SecurityPortletContainerWrapper.serveResource(SecurityPortletContainerWrapper.java:151) at com.liferay.portlet.RestrictPortletContainerWrapper.serveResource(RestrictPortletContainerWrapper.java:166) at com.liferay.portal.kernel.portlet.PortletContainerUtil.serveResource(PortletContainerUtil.java:163) ..... 2) Debugging the same test case I can see that the BridgeContext.setPortletRequest method is reflectively acquired, without errors. So the method is still there. I used liferay-portal-7.0-ce-b7 for testing.
        Hide
        Neil Griffin added a comment -

        What version of the bridge jars did you use?

        Show
        Neil Griffin added a comment - What version of the bridge jars did you use?
        Hide
        Neil Griffin added a comment - - edited

        I recompiled ICEfaces 4.1.1-SNAPSHOT from source and was able to get it working with 4.2.5-ga6 bridge jars and also the new version scheme.

        Why would line #210 be getting hit? Shouldn't isPortlet=true?

        if (isPortlet)

        { wrapper = getPortletRequestWrapper(requestObject, parameterMap); }

        else

        { wrapper = new FileUploadRequestWrapper((HttpServletRequest) requestObject, parameterMap); // line 210 }
        Show
        Neil Griffin added a comment - - edited I recompiled ICEfaces 4.1.1-SNAPSHOT from source and was able to get it working with 4.2.5-ga6 bridge jars and also the new version scheme. Why would line #210 be getting hit? Shouldn't isPortlet=true? if (isPortlet) { wrapper = getPortletRequestWrapper(requestObject, parameterMap); } else { wrapper = new FileUploadRequestWrapper((HttpServletRequest) requestObject, parameterMap); // line 210 }
        Hide
        Mircea Toma added a comment - - edited

        Okay, I can confirm Neil's findings now. Previously I removed also the call to getPortletRequestWrapper.

        Removed redundant call to method setPortletRequestWrapper.

        Show
        Mircea Toma added a comment - - edited Okay, I can confirm Neil's findings now. Previously I removed also the call to getPortletRequestWrapper . Removed redundant call to method setPortletRequestWrapper .
        Mircea Toma made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Neil Griffin added a comment -

        Thanks Mircea. I'll test when the next version of 4.1.1-SNAPSHOT is available.

        Show
        Neil Griffin added a comment - Thanks Mircea. I'll test when the next version of 4.1.1-SNAPSHOT is available.
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #48139 Wed Feb 24 13:40:41 MST 2016 mircea.toma ICE-10973 Removed redundant call to method 'setPortletRequestWrapper'.
        Files Changed
        Commit graph MODIFY /icefaces4/trunk/icefaces/ace/component/src/org/icefaces/ace/component/fileentry/FileEntryUpload.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #48140 Wed Feb 24 14:16:54 MST 2016 ken.fyten ICE-10973 Removed redundant call to method 'setPortletRequestWrapper'.
        Files Changed
        Commit graph MODIFY /icefaces4/tags/icefaces-4.1.1/icefaces/ace/component/src/org/icefaces/ace/component/fileentry/FileEntryUpload.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #48141 Wed Feb 24 14:17:41 MST 2016 ken.fyten ICE-10973 Removed redundant call to method 'setPortletRequestWrapper'.
        Files Changed
        Commit graph MODIFY /icefaces4/branches/icefaces-4.1.1/icefaces/ace/component/src/org/icefaces/ace/component/fileentry/FileEntryUpload.java
        Hide
        Ken Fyten added a comment -

        Re-opened to review if this change should also be made for ICEfaces EE 3.3.0.GA_P04?

        Show
        Ken Fyten added a comment - Re-opened to review if this change should also be made for ICEfaces EE 3.3.0.GA_P04?
        Ken Fyten made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Ken Fyten made changes -
        Fix Version/s EE-3.3.0.GA_P04 [ 12270 ]
        Hide
        Mircea Toma added a comment - - edited

        Applied change to maintenance branch as well. Also tested successfully the change on Liferay 6.2.

        Show
        Mircea Toma added a comment - - edited Applied change to maintenance branch as well. Also tested successfully the change on Liferay 6.2.
        Mircea Toma made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Ken Fyten made changes -
        Affects Version/s EE-3.3.0.GA_P03 [ 11572 ]
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Mircea Toma
            Reporter:
            Neil Griffin
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: