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

Default home page /web/guest is not layout-cached by CacheFilter

    Details

      Description

      The CacheFilter checks for a plid. It uses the plid to fetch the layout and make sure that it is a portlet layout and all portlets are "layout-cacheable".

      The system is uses (method getPlid) parses the url and search for a community and a page.

      In a url alike /web/guest/home it correctly find the "home" layout. In a url like "/web/guest" (which happen to be the default home page) it does not find "home", so resolves no layout, so refuses to cache.

      Since the home page is the page most commonly hit, and since it is often quite complicated, it is really a pity not to cache it when it could be possible.

      The fix I've made is to change getPlid so that it return the group default plid in such a situation. At line 215 (more or less) :

      // Layout friendly URL

      friendlyURL = null;

      if ((pos != -1) && ((pos + 1) != pathInfo.length()))

      { friendlyURL = pathInfo.substring(pos, pathInfo.length()); }

      if (Validator.isNull(friendlyURL)) {
      // SG
      // Force using the default plid, otherwise it does not cache the home page!!
      try

      { return LayoutLocalServiceUtil.getDefaultPlid(groupId, privateLayout); }

      catch (SystemException e)

      { _log.error(e); return 0; }

      // /SG
      }

      This way the default home is cached properly. I don't know if this can have any side effects.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sophia.zhang Sophia Zhang
              Reporter:
              simonegianni Simone Gianni (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, 20 weeks, 4 days ago

                  Packages

                  Version Package
                  6.1.1 CE GA2
                  6.1.20 EE GA2
                  6.2.0 CE M2