Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 6.1.1 CE GA2, 6.1.20 EE GA2
-
Fix Version/s: 6.1.X EE, 6.2.0 CE M5
-
Component/s: Configuration, Configuration > XML files, Standards > JSR-286 Portlets
-
Labels:
-
Environment:Windows 7 64 bits
6.1.1 CE GA2 Bundled with Apache Tomcat 7.0.27. This bundle embeds JRE 1.6.0_20
-
Branch Version/s:6.1.x
-
Backported to Branch:Committed
-
Story Points:3
-
Fix Priority:3
-
Similar Issues:Show 5 results
LPS-2697JSR 286 does not require ResourceResponse.setContentType to be called before fetching the PortletOutputStream LPS-4412Portlet description is not honored according to JSR 286 LPS-12255Resource requests not secured with defined roles (security-role-ref in portlet.xml) LPS-3667security constraint settings int portlet.xml are ignored LPS-25203 Implement the expiration cache according to JSR 286
Description
Liferay Portal ignores the <alias> element in the <event-definition> of portlet.xml
According to the JSR-286 spec:
"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)
According to this I should be able to wire a "supported-publishing-event" of one portlet and a "supported-processing-event" of another by setting an alias in one of them.
In my scenario I have two portlets: PortletSender and PortletReceiver.
- PortletSender has a link. When the user clicks it, the portlet sends an event with the current date (a java.lang.String object)
- When PortletReceiver receives this event, it shows it in a JSP.
Both portlets are in the same page.
The portlet.xml of PortletSender is:
<portlet-app version="2.0" ... xmlns:ns1="http://www.denodo.com/widget/portlet/portlet-sender">
<portlet>
<portlet-name>PortletSender</portlet-name>
...
<supported-publishing-event>
<qname>ns1:event1</qname>
</supported-publishing-event>
</portlet>
<event-definition>
<qname>ns1:event1</qname>
<alias xmlns:x="http://www.denodo.com/widget/portlet/portlet-receiver">x:testEvent</alias>
<value-type>java.lang.String</value-type>
</event-definition>
</portlet-app>
The portlet.xml of PortletReceiver is:
<portlet-app version="2.0" xmlns:ns2="http://www.denodo.com/widget/portlet/portlet-receiver">
<portlet>
<portlet-name>PortletReceiver</portlet-name>
<display-name>Portlet Receiver</display-name>
<portlet-class>com.denodo.test.PortletReceiver</portlet-class>
...
<supported-processing-event>
<qname>ns2:testEvent</qname>
</supported-processing-event>
</portlet>
<event-definition>
<qname>ns2:testEvent</qname>
<value-type>java.lang.String</value-type>
</event-definition>
</portlet-app>
You can see that the <alias> of "event1" is the same as the "qname" of "testEvent" in PortletReceiver.
However, the events never reach PortletReceiver.
If I change the qname of <event-definition> and <supported-processing-event> in PortletSender to "<qname xmlns:x="http://www.denodo.com/widget/portlet/portlet-receiver">x:testEvent</qname>", PortletReceiver receives the event.
Steps to Reproduce:
---------------------------------------
- Unzip the attached file. It creates to directories: PortletReceiver and PortletSender.
- Execute "maven war:war" in both directories.
- Copy the files PortletSender.war and PortletReceiver.war to %LIFERAY_HOME%/deploy
- In Liferay, add these portlets to the same page.
- Click on the link " Send event" of "Portlet Sender"
Actual Results:
---------------------------------------
Portlet B does not receive the event.
Expected Results:
---------------------------------------
Portlet B should receive the event.
If Portlet B receives the event, prints the string "Event received: ..." in System.out.
-
- portlet.xml
- 08/Mar/13 12:45 PM
- 1 kB
- Michael Young
-
- portlet.xml
- 08/Mar/13 12:45 PM
- 1 kB
- Michael Young
-
Hide
- PortletsSenderAndReceiver.zip
- 21/Nov/12 9:06 AM
- 11 kB
- Carlos Santos
-
- PortletReceiver/.classpath 0.6 kB
- PortletReceiver/.project 0.4 kB
- PortletReceiver/.../org.eclipse.jdt.core.prefs 0.2 kB
- PortletReceiver/project.xml 2 kB
- PortletReceiver/src/.../PortletReceiver.java 2 kB
- PortletReceiver/src/.../portletReceiver.jsp 0.3 kB
- PortletReceiver/src/.../liferay-portlet.xml 0.3 kB
- PortletReceiver/src/.../WEB-INF/portlet.xml 1 kB
- PortletSender/.classpath 0.6 kB
- PortletSender/.project 0.4 kB
- PortletSender/project.xml 1 kB
- PortletSender/src/.../PortletSender.java 2 kB
- PortletSender/src/.../portletSender.jsp 0.3 kB
- PortletSender/src/.../liferay-portlet.xml 0.3 kB
- PortletSender/src/.../WEB-INF/portlet.xml 1 kB
-
Hide
- sender_receiver.zip
- 20/Mar/13 10:44 AM
- 44 kB
- Michael Young
-
- jsr-receiver/.classpath 1 kB
- jsr-receiver/.DS_Store 6 kB
- __MACOSX/jsr-receiver/._.DS_Store 0.1 kB
- jsr-receiver/.project 0.4 kB
- jsr-receiver/bin/.DS_Store 6 kB
- jsr-receiver/bin/com/.DS_Store 6 kB
- jsr-receiver/bin/com/denodo/.DS_Store 6 kB
- jsr-receiver/bin/.../PortletReceiver.class 2 kB
- jsr-receiver/build.xml 0.2 kB
- jsr-receiver/docroot/.DS_Store 6 kB
- __MACOSX/jsr-receiver/.../._.DS_Store 0.1 kB
- jsr-receiver/docroot/.../main.css 0.0 kB
- jsr-receiver/docroot/css/main.css 0.0 kB
- jsr-receiver/docroot/icon.png 0.5 kB
- jsr-receiver/docroot/js/main.js 0.0 kB
- jsr-receiver/docroot/portletReceiver.jsp 0.3 kB
- __MACOSX/.../._portletReceiver.jsp 0.2 kB
- jsr-receiver/docroot/WEB-INF/.DS_Store 6 kB
- __MACOSX/jsr-receiver/.../._.DS_Store 0.1 kB
- jsr-receiver/.../PortletReceiver.class 2 kB
- jsr-receiver/.../liferay-plugin-package.properties 1 kB
- jsr-receiver/docroot/.../liferay-portlet.xml 0.3 kB
- __MACOSX/.../._liferay-portlet.xml 0.2 kB
- jsr-receiver/docroot/WEB-INF/portlet.xml 1 kB
- __MACOSX/jsr-receiver/.../._portlet.xml 0.2 kB
- jsr-receiver/docroot/.../src/.DS_Store 6 kB
- __MACOSX/jsr-receiver/.../src/._.DS_Store 0.1 kB
- jsr-receiver/docroot/.../com/.DS_Store 6 kB
- __MACOSX/jsr-receiver/.../com/._.DS_Store 0.1 kB
- jsr-receiver/docroot/.../denodo/.DS_Store 6 kB
Activity
I'm taking a look at this, but it seems that your attachment is missing a pom.xml file according to maven. I'm not familiar with maven so I would need your help:
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.481s
[INFO] Finished at: Wed Feb 20 11:04:17 PST 2013
[INFO] Final Memory: 4M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.3:war (default-cli): Goal requires a project to execute but there is no POM in this directory (/Users/myoung/Downloads/PortletsSenderAndReceiver/PortletReceiver). Please verify you invoked Maven from the correct directory. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
The file I attached includes two Eclipse projects (one for each portlet) that have to be exported to War files from Eclipse.
I will attach another .zip with a pom.xml so the portlets can be build with Maven.
Sorry for the inconvenience.
No worries. I was able to import your source into our structure, so no need.
I found an error in your portlet.xml. Aliases are supposed to be specified on the receiver, not on the sender. I've attached correct portlet.xml files for your reference.
PASSED Manual Testing following the steps in the description.
Reproduced on:
Tomcat 7.0 + MySQL 5. Portal 6.1.20 EE GA2.
Portlet B does not receive the event.
Fixed on:
Tomcat 7.0 + MySQL 5. Portal 6.1.x EE GIT ID: f6bfdf784b571ea7b692c3b4b2215e5b03b5b32e.
Tomcat 7.0 + MySQL 5. Portal 6.2.x GIT ID: 5df200a1cc8ab505c635c7e1ba6099b754125a5f.
Portlet B able to receive the event.
eg: Event received = '01:20:11 21-03-2013'.
Hello everyone! We are in the process of removing component "Portlet" from LPS. Please replace this issue's component, "Portlet", with a new component. There are over 200+ components, in the newly organized component list. Also, make the necessary adjustments to affected filters. Thanks!
I think that the current solution is not valid.
If you have a portlet with one <event-definition> that has an <alias>, and another portlet sends an event with the name set in the <alias>, the event reaches the second portlet (this is was fixed in this bug).
However, the method EventRequest.getEvent() (invoked from processEvent(...)), returns the event as defined in the <alias>, instead of as defined in the <qname> of the <event-definition>.
EventRequest.getEvent() "Returns the event that triggered the call to the processEvent method." so it should return the <qname> of <event-definition>, not the <alias>.
In the example I attached, I have two portlets: PortletSender and PortletReceiver (see the .zip file attached to the bug, but use the portlet.xml files corrected by @Michael Young)
- "PortletSender" can send this event:
<event-definition> <qname>ns1:event1</qname>}} <value-type>java.lang.String</value-type> </event-definition>
being ns1="http://www.denodo.com/widget/portlet/portlet-sender"
- "PortletReceiver" can receive this event:
<event-definition> <qname>ns2:testEvent</qname> <alias xmlns:x="http://www.denodo.com/widget/portlet/portlet-sender">x:event1</alias> <value-type>java.lang.String</value-type> </event-definition>
After fixing this bug, when "PortletSender" sends the event ns1:event1, it reaches "PortletReceiver" thanks to the <alias> defined in the "PortletReceiver"'s portlet.xml.
However, the javax.portlet.Event, returned by the method EventRequest.getEvent() }}(invoked from {{processEvent(...)) represents the event x:event1. But it should represent the event ns2:testEvent instead.
Tested with "Liferay Portal 6.2.0 CE-Milestone 5" bundled with "Apache Tomcat 7.0.34"
I forgot to mention that in Liferay 5.2.3 with OpenPortal Portlet Container, the events sent by PortletSender reach PortletReceiver.