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

When using Liferay under a /context, themes can't seem to find init template (with preposed solution)

    Details

    • Branch Version/s:
      6.0.x
    • Backported to Branch:
      Committed

      Description

      While resolving init template in freemarker (don't know about velocity), the com.liferay.portal.freemarker.ServletTemplateLoader tries to lookup the context using
      ServletContextPool.get(servletContextName) where servletContextName = public (not /public)
      Since com.liferay.portal.util.PortalImpl uses the following to get the context

      _pathContext = PropsUtil.get(PropsKeys.PORTAL_CTX);

      if (_pathContext.equals(StringPool.SLASH))

      { _pathContext = StringPool.BLANK; }

      without reguards to where tomcat places the context. The portal.ctx and tomcat MUST be in sync
      Also, since looking up "public" but the context is at "/public", ServletTemplateLoader will never find the init template

      I made a patch in ServletTemplateLoader to pre-pend the context with a slash.

      // try to get the context with a prefix. Workaround for the config/context mis-match issue.
      if (servletContext == null)

      { servletContext = ServletContextPool.get( String.format("/%s", servletContextName)); }

      I'm not completely confidante this is 100% correct, but it works for my installation.
      Just filing this to try to give back to the community

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              paul.piao Paul Piao (Inactive)
              Reporter:
              javajoe Joe Fisher (Inactive)
              Participants of an Issue:
              Recent user:
              Esther Sanz
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                9 years, 7 weeks, 3 days ago

                  Packages

                  Version Package
                  6.0.12 EE