Eventing in Liferay Portlets

假如想象 提交于 2019-12-04 07:49:35
Tony Rad

JSR-286 (latest Java Portlet Specification) defines Server Side and Client side Inter Portlet Communication (IPC). For Liferay implementation they are well described here and here.

First question:

In any portlet application, if the same page containing a portlet is opened in two browser tabs, how is the event in the first page distinguished from the second page?

  • Client Side IPC: it is NOT possible to fire and listen a Liferay javascript event between two different browser tabs. So they will be automatically distinguished. However you may use a cookie based approach to implement it (look here if interested)
  • Server Side IPC: it is possible to share data (server side) between different client windows using server side IPC (see the above Liferay's links for examples)
Second question:

I want to assign a unique Id for each event, store it and append it to the URL so that the link can be shared. Can someone provide their thoughts on this?

Also, if the page URL is opened on other computer the data shown on the page is the same as the data seen on the first computer. This is being set globally. How can I eliminate this?

  • I'm assuming you're talking of the same Liferay User account (otherwise it is possible to scope data by role, user, group, user group or organization in Liferay). To differentiate data among different computers for the same user, you can store and pass back to the portal cookie(s) with state information about the client computer. See here for how to set cookie in Liferay.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!