1

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!

4

1 回答 1

1

在使用 liferay 的论坛后,网络上的其他几个 WSRP 资源和搜索引擎现在都可以使用了。

以下三件事似乎是我遇到 WSRP 问题的主要原因:

  • requires-namespaced-parameters 必须显式设置为 false
  • 必须停用 CSRF 令牌,我通过 init-param 在 portlet-xml 中完成了此操作:

    <init-param>
      <name>check-auth-token</name>
      <value>false</value>
    </init-param>
    
  • 在事件处理方法中创建渲染参数时,视图 JSP 中似乎没有渲染参数,因此我切换到 portlet 会话属性以将数据从 portlet 类传输到 JSP 视图

于 2014-05-22T13:47:55.077 回答