Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-5581

CachingRes​ourceStrea​mLocator is not extension-​aware

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 6.15.0
    • 6.16.0, 7.0.0-M2
    • wicket
    • None

    Description

      Consider, as a real case scenario, an application that integrates with Apache FOP in a way that, by overriding Page's getMarkupType(), makes it possible to have a component render its .fo markup (to generate a PDF) instead of the usual html, depending on whether it is added to a Page with the fo MarkupType or the standard html one.

      This means the typical Panel of such application has two markup files, an html one and a fo one: Panel.html and Panel.fo.

      The default CachingRes​ourceStrea​mLocator makes use of ResourceReference#Key for the cache. That Key completely ignores the extension of the file or, better, assumes it is part of the name, while for markup files this is apparently not the case. Basically, Panel.html and Panel.fo have the same Key, the name of which is simply "Panel".

      Therefore, when a Panel is first rendered in html, its html markup reference is cached and there is no way to make it render again in fo, because the cache will always return the html markup reference.

      A workaround suggested by Martin Grigorov in the Users mailing list is to override #getVariation() for the pages and return "html" and "fo" respectively.

      However, the solution would be to fix CachingResourceStreamLocator to fully support this use case and properly cache different markup files of the same class.

      Attachments

        Activity

          People

            mgrigorov Martin Tzvetanov Grigorov
            MacrosorcH Fabio Fioretti
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: