Message Boards

IPC Events with Redirect on Liferay 7

Ramon Garcia, modified 4 Years ago.

IPC Events with Redirect on Liferay 7

New Member Posts: 21 Join Date: 2/11/10 Recent Posts
Hi,I want to use IPC events between two portlets in different pages....
I try it with the com.liferay.faces.demo.jsf.ipc.events.bookings.portlet and com.liferay.faces.demo.jsf.ipc.events.customers.portlet...
I deploy:
  •  CUSTOMERS on page  /page1
  • BOOKINGS on page /page2 
I try to change selectionListener  method on CustomersBackingBean like:
[code]    public void selectionListener(ActionEvent actionEvent) {

      UICommand uiCommand = (UICommand) actionEvent.getComponent();
      Customer customer = (Customer) uiCommand.getValue();
      QName qName = new QName("http://liferay.com/events", "ipc.customerSelected");
      ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
      ActionResponse actionResponse = (ActionResponse) externalContext.getResponse();

      Serializable eventPayload = customer;
      actionResponse.setEvent(qName, eventPayload);

      try {
         externalContext.redirect("http://localhost:8080/web/guest/page2");
      } catch (IOException e) {
         e.printStackTrace();
      }
                                         
   }
In this test... I create the URL manually..... but the CustomerSelectedEventHandler is not called...
On Liferay 6.2 I do a similar solution and it works...
How can do it on Liferay 7??
Thanks in advance for help....
thumbnail
Neil Griffin, modified 4 Years ago.

RE: IPC Events with Redirect on Liferay 7

Liferay Legend Posts: 2655 Join Date: 7/27/05 Recent Posts
Hi Ramon,Please see Vernon Singleton's reply to a similar thread. Is it possible that you forgot to put the settings in portal-ext.properties?Kind Regards,Neil
Ramon Garcia, modified 4 Years ago.

RE: IPC Events with Redirect on Liferay 7

New Member Posts: 21 Join Date: 2/11/10 Recent Posts
Hi Neil,I have all these settings in my portal-ext.properties....  also I have:portlet.public.render.parameter.distribution=layout-set
Some suggestion about the redirection URL creation or similar?? I have not idea about where are my mistake..Thanks in advance for this help!
thumbnail
Neil Griffin, modified 4 Years ago.

RE: IPC Events with Redirect on Liferay 7

Liferay Legend Posts: 2655 Join Date: 7/27/05 Recent Posts
Hi Ramon,I'm not sure if this is will fix the problem, but I recommend that you try disabling SennaJS and see if it starts working.Kind Regards,Neil
Ramon Garcia, modified 4 Years ago.

RE: IPC Events with Redirect on Liferay 7

New Member Posts: 21 Join Date: 2/11/10 Recent Posts
Hi Neil,Thanks for your fast reply!I've tried the 3 solutions for disable SennaJS... and the result is the same... it navigates to the new page but no IPCHandler is called.....Some other idea?Thanks in advance!
thumbnail
Neil Griffin, modified 4 Years ago.

RE: IPC Events with Redirect on Liferay 7

Liferay Legend Posts: 2655 Join Date: 7/27/05 Recent Posts
Hi Ramon,
I wanted to let you know that I have reproduced the problem locally. I hope to have more time tomorrow to find a workaround or a way to fix it.
Kind Regards,
Neil
thumbnail
Neil Griffin, modified 4 Years ago.

RE: IPC Events with Redirect on Liferay 7

Liferay Legend Posts: 2655 Join Date: 7/27/05 Recent Posts
Hi Ramon,
I did some investigating and I think this is a regression introduced to Liferay Portal 7.1 and 7.2 by LPS-76771 by this commit.
I was able to workaround the problem in the jsf-ipc-events-customers-portlet by adding the following to src/main/webapp/WEB-INF/liferay-portlet.xml:
<action-url-redirect>true</action-url-redirect>


Please let me know if that is a viable workaround for you.

The only other option I can see is to wait for a fix. For more information you can "watch" the following issue in JIRA: LPS-103415.
Kind Regards,
Neil
Ramon Garcia, modified 4 Years ago.

RE: IPC Events with Redirect on Liferay 7

New Member Posts: 21 Join Date: 2/11/10 Recent Posts
Hi Neil!
Your workaround works!! and now I can do redirect with  jsf-ipc-events-customers-portlet and also with my custom portlet!!!
Thank you very much for your help!!! 
thumbnail
Neil Griffin, modified 4 Years ago.

RE: IPC Events with Redirect on Liferay 7

Liferay Legend Posts: 2655 Join Date: 7/27/05 Recent Posts
Hi Ramon,
I'm glad to learn that the workaround is good enough for your use-case. Thanks for reporting back and thanks for using Liferay Faces.
Neil