Fórum

Liferay 6 // can I send an event to another portlet of another WAR?

Carlos Santos, modificado 11 Anos atrás.

Liferay 6 // can I send an event to another portlet of another WAR?

New Member Postagens: 3 Data de Entrada: 10/11/09 Postagens Recentes
In Liferay 6, is it possible to send an event from one portlet to another?
Each portlet belongs to a WAR file.
Both portlets are in the same page.

I have two portlets A and B, each in a different WAR files. Portlet A can send an event and B receive it.
If I deploy these two wars in Liferay 5.2.3, it works fine if first, I add the property
portlet.container.impl=sun
to the portlet-ext.properties file.

In Liferay 6.1.1, when one of the portlet sends and event, the other does not receive it.
It does not matter if I create the portlet-ext.properties file.

Does this has something to do with the fact Liferay 6 does not support Open Portal Portlet Container? (I read it in this post)

Environment:
- "Liferay Portal Community Edition 6.1 CE GA2 bundled with Apache Tomcat" and "Liferay Portal Community Edition 5.2.3 bundled with Apache Tomcat".
- Windows 7.


Thank you in advance.

P.S: I have searched in the forum and on Google and I did not find any examples with Liferay 6. Only with Liferay 5.
Carlos Santos, modificado 11 Anos atrás.

RE: Liferay 6 // can I send an event to another portlet of another WAR?

New Member Postagens: 3 Data de Entrada: 10/11/09 Postagens Recentes
I have found more information about my problem.
In my portlets I use <alias> to "link" an event published by Portlet A to an event expected by Portlet B.

Liferay 6 portlets container seem to ignore the <alias> definitions of events in the portlet.xml.

According to the JSR-286 spec, Liferay should take this into account
The portlet can specify additional alias names in order to enable portals performing an automatic wiring between events.
(section "PLT.15.2.4.1 Declaration in the deployment descriptor" of the JSR-286 spec)

In the portlet.xml of Portlet A I define an event like this:
<event-definition>
    <description>Event containing the value of the column 'IINC_ID' of the selected row.</description>
    <qname>dnd:Selected_IINC_ID</qname>
    <alias xmlns:x="http://www.denodo.com/widget/portlet/portletjsr286-phone_inc">x:Input_PINC_ID</alias>
    <value-type>java.lang.String</value-type>
</event-definition>


In the portlet.xml of Portlet B I define the target event like this:
<event-definition>
    <description>Event for the input parameter 'PINC_ID'.</description>
    <qname>dnd:Input_PINC_ID</qname>
    <value-type>java.lang.String</value-type>
</event-definition>


In Portlet B, "dnd" is the prefix of the namespace "http://www.denodo.com/widget/portlet/portletjsr286-phone_inc".
That is, the <alias> of the event in Portlet A is the same as the <qname> of the event in Portlet B.

If, in the portlet.xml of Portlet A, I remove the <alias> from the definition of the event and change the <qname> so it is the same as the event in Portlet B, the event sent by Portlet A reaches Portlet B.
However, in my scenario it is not feasible to change the name of the events.


In the class com.liferay.portal.action.LayoutAction, the method processEvents(...) invokes the method getProcessingEvent(...) of the com.liferay.portal.model.impl.PortletImpl. To evaluate if the event received by Portlet B is a "supported-processing-event", it seems that getProcessingEvent(...) just uses the "qname" of the event. It ignores if the event has an alias in the portlet.xml of the portlet that sends the event or in the portlet that receives it.
Carlos Santos, modificado 11 Anos atrás.

RE: Liferay 6 // can I send an event to another portlet of another WAR?

New Member Postagens: 3 Data de Entrada: 10/11/09 Postagens Recentes
I have opened a bug report in Liferay's JIRA: http://issues.liferay.com/browse/LPS-31143