-
Type:
Bug
-
Status: Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: liferay-faces-2.1.0-ga1, liferay-faces-2.1.1-ga2, liferay-faces-3.0.0-legacy-ga1, liferay-faces-3.0.1-legacy-ga2, liferay-faces-3.0.0-ga1, liferay-faces-3.0.1-ga2, liferay-faces-3.1.0-ga1, liferay-faces-3.1.1-ga2
-
Component/s: Liferay Faces Bridge Impl / Demos / Tests
-
Labels:None
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.