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

Asset renderer JSPs from a portlet web module that opts-in to Portlet 3.0 cannot use the Portlet 3.0 JSP taglib

    Details

      Description

      Workaround

      Since this issue was originally filed, I found a workaround by using the underlying HttpServletRequest instead of the LiferayPortletRequest:

      Workaround.java
      LiferayPortletURL liferayPortletURL = _portletURLFactory.create(
      	_portal.getHttpServletRequest(liferayPortletRequest), MyPortletKey,
      	_getControlPanelLayout(liferayPortletRequest), PortletRequest.RENDER_PHASE);
      
      private static Layout _getControlPanelLayout(PortletRequest portletRequest) {
      
      	ThemeDisplay themeDisplay =
      		(ThemeDisplay)portletRequest.getAttribute(
      			WebKeys.THEME_DISPLAY);
      
      	Group group = (Group)portletRequest.getAttribute(
      		WebKeys.ASSET_RENDERER_FACTORY_GROUP);
      
      	Layout controlPanelLayout = null;
      
      	if (themeDisplay != null) {
      		controlPanelLayout = themeDisplay.getControlPanelLayout();
      
      		if (group == null) {
      			group = themeDisplay.getScopeGroup();
      		}
      	}
      
      	if (controlPanelLayout == null) {
      		return null;
      	}
      
      	if (group.isControlPanel()) {
      		return controlPanelLayout;
      	}
      
      	return new VirtualLayout(controlPanelLayout, group);
      }
      
      

      Problem Background

      The portlets provided by the asset-publisher-web module utilize Portlet 2.0 API. Because of this, it is not possible for a JSP provided by a portlet web module (either a .jar or .war module) to use the Portlet 3.0 JSP taglib. In order to fix the problem, the following portlets must opt-in to Portlet 3.0 by specifying the "javax.portlet.version=3.0" service property:

      • AssetPublisherPortlet.java
      • HighestRatedAssetsPortlet.java
      • MostViewedAssetsPortlet.java
      • RecentContentPortlet.java
      • RelatedAssetsPortlet.java

      Note that this problem is similar to LPS-87974.

      Steps to Reproduce

      1. Start Liferay Portal 7.2.0 CE GA 1 and copy the attached artifacts $LIFERAY_HOME/osgi/modules:

      • com.liferay.training.gradebook.api.jar
      • com.liferay.training.gradebook.service.jar
      • gradebook.web.jar

      2. Add the "GradebookWeb" portlet to a page

      3. Click on the "Create Asset" button and verify that the list of assets includes a new row:

      Title
      -----
      My Assignment Title
      

      4. Add the Asset Publisher to a page

      Expected Results

      The asset publisher should show the following AND there are no errors in the console log:

      My Assignment Title
      Test Test
      Modified x Minutes ago.
      
      abstract.jsp DESCRIPTION=My Assignment Description
      

      Actual Results

      The asset publisher does not show abstract.jsp, but rather shows the default content:

      My Assignment Title
      Test Test
      Modified x Minutes ago.
      My Assignment Description
      

      AND the following stacktrace appears in the console log:

      Caused by: java.lang.UnsupportedOperationException: Requires 3.0 opt-in
      	at com.liferay.portlet.internal.PortletRequestImpl.getRenderParameters(PortletRequestImpl.java:520)
      	at com.liferay.taglib.portlet.DefineObjectsTag3.doStartTag(DefineObjectsTag3.java:91)
      	at org.apache.jsp.asset.abstract_jsp._jspService(abstract_jsp:90)
      	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
      	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:411)
      	... 254 more
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              support-lep@liferay.com SE Support
              Reporter:
              neil.griffin Neil Griffin
              Participants of an Issue:
              Recent user:
              Neil Griffin
              Engineering Assignee:
              Neil Griffin
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Days since last comment:
                44 weeks ago

                  Packages

                  Version Package