Uploaded image for project: 'Magnolia Resources Module'
  1. Magnolia Resources Module
  2. MGNLRES-152

Generate links to resources, and use selectors with ~ to generate farFutureCaching URLs for resources

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 2.4
    • None
    • None
    • None

      The model class used for resources (info.magnolia.module.resources.Resource) currently generates its "far future caching" links with dots, e.g /resources/foo/bar.2015-05-22-16-00-35-123.cache.css.

      This is then "converted" to using ~ by a virtual URI configured in the cache module, which was added via MAGNOLIA-4207 (SCRUM-699).

      Finally, the RepositoryMappingFilter strips out the ~ from the current uri set in AggregationState, and sets handle and currentNode.

      While convoluted, this works, as long as we load resources after this filter, e.g with the rendering mechanism and the special Resource*Renderers.

      If we serve resources via a Servlet, the current uri in AggregationState still has ~'s in it, since servlets are interrupting the filter chain before it reaches the RepositoryMappingFilter. Besides, using a servlet has the added benefit that we can use pathInfo (as opposed to the complete URI, which includes the path to the servlet).

      Suggested approach:

      • fix info.magnolia.module.resources.Resource: use ~ directly, no reason to use .
      • remove now-unnecessary virtual uri mapping from cache module (see MGNLCACHE-106)
      • future: review filter chain. RepositoryMappingFilter and a few other filters have responsibilities that belong somewhere, and/or are simply wrongly named. See MAGNOLIA-6217.

      Essentially, this is all due to MAGNOLIA-2343, which we've ignored until now.

      Meanwhile, we should also factor out the far-future-link generation:

      • info.magnolia.module.resources.servlets.ResourcesServlet#stripFarFutureCachingTimestamp
      • info.magnolia.module.resources.Resource.getLink()
      • info.magnolia.cms.util.LinkUtil has the methods we want but is unused except in DefaultImageProvider (which is probably a good thing, because neither name nor location of this class are good)

      We'll also need to investigate browser cache, i.e /modules/cache/config/configurations/default/browserCachePolicy/policies/farFuture/voters/dotCacheExtension

        Acceptance criteria

              gjoseph Magnolia International
              gjoseph Magnolia International
              Nucleus
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD