Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-150421

Option to by-pass the target portlet spec version check when creating LiferayPortletURL

Details

    Description

      When creating LiferayPortletURL inside portlet 2.0 for portlet 3.0 using either JSP taglib or using URL builder, it fails

      PortletURL url = PortletURLBuilder.createLiferayPortletURL(
      	liferayPortletResponse,
      	"com_server_portal_MyV3Portlet",
      	PortletRequest.RENDER_PHASE
      ).buildPortletURL();
      
      java.lang.UnsupportedOperationException: Requires 3.0 opt-in
      	at com.liferay.portlet.internal.PortletRequestImpl.getRenderParameters(PortletRequestImpl.java:523) ~[portal-impl.jar:?]
      	at com.liferay.portlet.internal.PortletURLImpl._initMutableRenderParameters(PortletURLImpl.java:1642) ~[portal-impl.jar:?]
      	at com.liferay.portlet.internal.PortletURLImpl.<init>(PortletURLImpl.java:1317) ~[portal-impl.jar:?]
      	at com.liferay.portlet.internal.PortletURLImpl.<init>(PortletURLImpl.java:117) ~[portal-impl.jar:?]
      	at com.liferay.portlet.internal.RenderURLImpl.<init>(RenderURLImpl.java:44) ~[portal-impl.jar:?]
      	at com.liferay.portlet.internal.PortletURLFactoryImpl._create(PortletURLFactoryImpl.java:236) ~[portal-impl.jar:?]
      	at com.liferay.portlet.internal.PortletURLFactoryImpl._create(PortletURLFactoryImpl.java:248) ~[portal-impl.jar:?]
      	at com.liferay.portlet.internal.PortletURLFactoryImpl.create(PortletURLFactoryImpl.java:185) ~[portal-impl.jar:?]
      	at com.liferay.portal.kernel.portlet.PortletURLFactoryUtil.create(PortletURLFactoryUtil.java:123) ~[portal-kernel.jar:?]
      	at com.liferay.portlet.internal.LiferayPortletURLPrivilegedAction.run(LiferayPortletURLPrivilegedAction.java:141) ~[portal-impl.jar:?]
      	at com.liferay.portlet.internal.PortletResponseImpl.createLiferayPortletURL(PortletResponseImpl.java:307) ~[portal-impl.jar:?]
      	at com.liferay.portlet.internal.PortletResponseImpl.createLiferayPortletURL(PortletResponseImpl.java:273) ~[portal-impl.jar:?]
      	at com.liferay.portlet.internal.PortletResponseImpl.createLiferayPortletURL(PortletResponseImpl.java:265) ~[portal-impl.jar:?]
      	at com.liferay.portlet.internal.PortletResponseImpl.createLiferayPortletURL(PortletResponseImpl.java:319) ~[portal-impl.jar:?]
      	at com.liferay.petra.portlet.url.builder.PortletURLBuilder.createLiferayPortletURL(PortletURLBuilder.java:131) ~[com.liferay.petra.portlet.url.builder.jar:?]
      	at org.apache.jsp.message_005fboards.view_jsp._jspService(view_jsp:654) ~[?:?]
      

      There is no easy workaround when that LiferayPortletURL is created by LR code. You can either downgrade your portlet code or concatenate the URL manually.

      Examples:

      • Your module have administration interface suited for the control panel. In such case you can create panel app, but the link for the control panel is built using LR code so it fails when your portlet is based on Portlet 3.0 spec.
      • You override some default LR module, e.g. Message Boards (MB). If you need to create link pointing to your 3.0 portlet, it again fails as MB is 2.0 based.

      I think that portlet spec version check is too restrictive. Such link AFAIK works without problems.

      Such relaxed option would be especially handy for entries injected into UI dynamically by LR code. Now they have to be Portlet 2.0 based. 

      Attachments

        Activity

          People

            david.truong David Truong
            honyk Jan Tošovský
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:

              Packages

                Version Package