Uploaded image for project: 'PUBLIC - Liferay Faces'
  1. PUBLIC - Liferay Faces
  2. FACES-1465

Events IPC does not properly execute bridgeEventHandler when portlets are on different portal pages

    Details

      Description

      This issue was first reported in the forums here:
      http://www.liferay.com/community/forums/-/message_boards/view_message/18873590#_19_message_18875576

      Note that the summary field of this issue reflects what "seems" to be wrong at first glance, but actually the problem is a little more subtle...

      Steps to Reproduce

      1) Add the following to portal-ext.properties:

      portlet.event.distribution=layout-set
      layout.default.p_l_reset=false
      tags.compiler.enabled=false
      

      2) For the jsf2-ipc-events-customers-portlet, add the following code to the end of the selectionListener(ActionEvent) method:

      try {
      	externalContext.redirect("http://localhost:8080/web/guest/events-bookings");
      } catch (IOException e) {
      	e.printStackTrace();
      }
      

      3) Rebuild the jsf2-ipc-events-customers-portlet and deploy it to Liferay Portal

      4) Create a portal page named "Customers" in the Guest community and add the "JSF2 IPC (Events) - Customers" portlet to the page

      5) Deploy the jsf2-ipc-events-bookings-portlet to Liferay Portal

      6) Create a portal page named "Bookings" in the Guest community and add the "JSF2 IPC (Events) - Bookings" portlet to the page

      7) Click on one of the customers on the "Customers" page

      If the bug still exists, then the Bookings page will be displayed, but the bookings portlet will not show the noCustomerSelected.xhtml view

      If the bug is fixed, then the Bookings page will be displayed and the bookings portlet will show the bookings.xhtml view

      Detailed description of what is happening

      1) On Page "Customers", clicking on a customer in the Customers portlet causes the browser to submit an HTTP POST request
      2) The ACTION_PHASE of the portlet lifecycle executes for Page "Customers"
      3) The CustomersBackingBean.selectionListener(ActionEvent) method executes
      3a) The event is created queued in order to facilitate IPC
      3b) Calling ExternalContext.redirect(String redirectURL) simply sets a reminder for Liferay Portal to redirect to Page "Bookings"
      4) The EVENT_PHASE of the portlet lifecycle executes for Page "Customers"
      4a) Liferay Faces Bridge executes the CustomerSelectedEventHandler since it is registered in WEB-INF/portlet.xml
      4b) Liferay Faces Bridge triggers the navigation rule with the outcome of the handleEvent(FacesContext, Event) method
      4c) Liferay Faces Bridge remembers the new viewId that happened as a result of the navigation-rule
      5) Liferay Faces Bridge sets a bridgeRequestScopeId render parameter for Page "Customers", so that the BridgeRequestScope can be restored during the RENDER_PHASE
      6) Liferay Portal calls HttpServletRequest.sendRedirect(String) which returns HTTP status 302 back to the browser with the redirectURL from step #3
      7) The browser issues an HTTP GET request for the redirect URL
      8) The RENDER_PHASE of the portlet lifecycle executes for Page "Bookings"
      9) Liferay Faces Bridge attempts to retrieve the bridgeRequestScopeId render parameter for Page "Bookings", but doesn't find one, since step #5 set the render parameter for Page "Customers"

      Because step #9 fails, Liferay Faces Bridge does not realize that it needs to show the viewId from step #4c.

        Attachments

          Activity

            People

            • Assignee:
              neil.griffin Neil Griffin
              Reporter:
              neil.griffin Neil Griffin
              Participants of an Issue:
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Subcomponents