Fóruns

Início » Liferay Portal » English » 3. Development

Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
toggle
Carlos Santos
Liferay 6 // can I send an event to another portlet of another WAR?
20 de Novembro de 2012 11:11
Resposta

Carlos Santos

Ranking: New Member

Mensagens: 3

Data de entrada: 10 de Novembro de 2009

Mensagens 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
1portlet.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
RE: Liferay 6 // can I send an event to another portlet of another WAR?
21 de Novembro de 2012 08:18
Resposta

Carlos Santos

Ranking: New Member

Mensagens: 3

Data de entrada: 10 de Novembro de 2009

Mensagens 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:
1<event-definition>
2    <description>Event containing the value of the column 'IINC_ID' of the selected row.</description>
3    <qname>dnd:Selected_IINC_ID</qname>
4    <alias xmlns:x="http://www.denodo.com/widget/portlet/portletjsr286-phone_inc">x:Input_PINC_ID</alias>
5    <value-type>java.lang.String</value-type>
6</event-definition>


In the portlet.xml of Portlet B I define the target event like this:
1<event-definition>
2    <description>Event for the input parameter 'PINC_ID'.</description>
3    <qname>dnd:Input_PINC_ID</qname>
4    <value-type>java.lang.String</value-type>
5</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
RE: Liferay 6 // can I send an event to another portlet of another WAR?
21 de Novembro de 2012 09:55
Resposta

Carlos Santos

Ranking: New Member

Mensagens: 3

Data de entrada: 10 de Novembro de 2009

Mensagens recentes

I have opened a bug report in Liferay's JIRA: http://issues.liferay.com/browse/LPS-31143