PUBLIC - Liferay Portal Community Edition
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-25992

It is not possible to display structured web-content in third-party portlet.

    Details

    • Liferay Contributor's Agreement:
      Accept
    • Similar Issues:
      Show 4 results 

      Description

      We implementing own portlet - this portlet shoudl display web-content by specified articleId.
      So, to do it we are using followed code:

      <%
      JournalArticleDisplay articleDisplay = JournalContentUtil.getDisplay(themeDisplay.getScopeGroupId(), String.valueOf(articleId), null, themeDisplay.getLanguageId(), themeDisplay);
      %>

      <%= displayArticle == null ? StringPool.BLANK : displayArticle.getContent() %>

      this works fine for normal articles - but in case we are trying to display template driven article - we always got null from getDisplay method.

        Issue Links

          Activity

          Hide
          Alexey Kakunin added a comment -

          Problem in com.liferay.portal.kernel.templateparser.BaseTransformer class - in method transform it creates templateParser (actually com.liferay.portlet.journal.util.VelocityTemplateParser) with using current thread classloader - which is plugins classloader - and failed (since this class is from portal-impl and not available fro plugins).

          To fix this bug we need to use portal's classloader and change code in lines starting from 143 to:

          if (Validator.isNotNull(templateParserClassName)) {
          TemplateParser templateParser = null;
          // Fix for LPS-25992
          ClassLoader classLoader =
          PortalClassLoaderUtil.getClassLoader();

          try

          { templateParser = (TemplateParser)InstanceFactory.newInstance(classLoader, templateParserClassName); }

          catch (Exception e)

          { throw new TransformException(e); }
          Show
          Alexey Kakunin added a comment - Problem in com.liferay.portal.kernel.templateparser.BaseTransformer class - in method transform it creates templateParser (actually com.liferay.portlet.journal.util.VelocityTemplateParser) with using current thread classloader - which is plugins classloader - and failed (since this class is from portal-impl and not available fro plugins). To fix this bug we need to use portal's classloader and change code in lines starting from 143 to: if (Validator.isNotNull(templateParserClassName)) { TemplateParser templateParser = null; // Fix for LPS-25992 ClassLoader classLoader = PortalClassLoaderUtil.getClassLoader(); try { templateParser = (TemplateParser)InstanceFactory.newInstance(classLoader, templateParserClassName); } catch (Exception e) { throw new TransformException(e); }
          Hide
          Richard Gibson added a comment -

          This is a duplicate of LPS-18364

          Show
          Richard Gibson added a comment - This is a duplicate of LPS-18364

            People

            • Votes:
              1 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                3 years, 16 weeks, 3 days ago

                Development

                  Structure Helper Panel