1
votes

Currently I'm checking out Liferay and its portlet feature, especially remote portlets via WSRP.

I've got two liferay instances running on different machines in the same network. Now I want to share a portlet from one of the liferay instances to the other, so I've installed the WSRP app on both installations and configured one of the nodes as WSRP Producer and the other as WSRP Consumer. My WSRP Producer publishes the portlet for currency calculations (Währungsrechner in German) which is included in Liferay. At first glance, this WSRP portlet seems to work on the WSRP consumer side - I can add it to a page of the WSRP consumer and its content (some input boxes) is displayed correctly.

But there is one problem:

The HTML form rendered by the portlet always submits to the WSRP produder's domain, not to the WSRP consumer's domain as I would expect. The action attribute of the tag contains the wrong domain name.

I've also written a small portlet for debugging purposes using the Liferay UI which simply prints the output of the JSP-Tag , installed it on the WSRP producer and embedded it in a page of the WSRP consumer. The URLs printed by this simple debugging portlet are always absolute URLs and point to the WSRP producer, even when the portlet is displayed on the WSRP consumer. I would expect that the URLs are either relative or that they point to the correct domain, e.g. to the WSRP consumer domain when the portlet is displayed via a page on the WSRP consumer liferay instance.

The reason for my evaluation of Liferay is, that we want to check if it is a suitable solution for developing portlets and providing these portlets via WSRP for remote usage. To further investigate the problem I've built a small debug portlet with the Liferay SDK and Eclipe Plugin. The portlet mainly consists of a simple JSP page which prints out the result of :


    <%@ taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet" %>
    <span class="important"%>portlet:actionURL: </span><portlet:actionURL/%>

When I install this portlet on lifery.mycompany.net and publish it via the WSRP producer to liferay-2.mycompany.net, the output URL is:


    http://liferay.mycompany.net:8080/de_DE/widget/web/wsrp-achimstestproducer/portlets?p_auth=0iLgJP7e&p_p_id=sbdebug_WAR_sbliferaydemopluginportlet_INSTANCE_qs2S&p_p_lifecycle=1&p_p_state=normal&p_p_mode=view

Please note that the domain is liferay.mycompany.net instead of the expected liferay-2.mycompany.net.

How can I fix this? Do I need to adjust Liferay's configuration so that the WSRP Consumer replaces URLs from WSRP portlets with its own URL? Are there other factors that affect WSRP portlets and actionURLs? Any help on this issue would be greatly apreciated!

My setup is: - Liferay 6.2 CE with Tomcat 7 - Database is MySQL 5.5 - Oracle Java 7 - Liferay was configured with the inbuilt installation wizard

Thanks in advance!

2014-05-23: Here's some more info

I've also posted this question with some additional info in liferay's forums:

--> setting requires-namespaced-parameters to false in liferay-portlet.xml seems to fix the domain problem, but still the portlet's processAction method is not executed when the portlet is used via WSRP :(

Am I doing something wrong here? Any ideas and hints are welcome!

1
I've also posted this question with some additional info in liferay's forums:Achim

1 Answers

1
votes

After using liferay's forum, several other WSRP resources on the web an search engines a lot it now works.

The following three things seemed to be the major causes for my problems with WSRP problems:

  • requires-namespaced-parameters must explicitly be set to false
  • CSRF token must be deactivated, I've did this in portlet-xml via init-param:

    <init-param>
      <name>check-auth-token</name>
      <value>false</value>
    </init-param>
    
  • Render parameters don't seem to be available in the view JSP when the render parameter was created in an event processing method, therefore I switched to portlet session attributes to transport data from the portlet class to the JSP view