Tapestry 5
  1. Tapestry 5
  2. TAP5-90

Context assets should be versioned and provided with a far future expires header, just like classpath assets

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 5.0.15
    • Fix Version/s: 5.1.0.0
    • Component/s: None
    • Labels:
      None

      Description

      This is as-per YSlow recommendations, assets in the context (i.e., the context: asset prefix) should be treated like classpath: assets; the URL sent to the browser should reflect a version number (defined by the application) and the files should be given a far future expiration date.

      So the URL might be "/app-assets/1.2.3/images/logo.gif" for a file referenced as "context:images/logo.gif". The application would define the version number. It would be the developer's responsibility to advance the version number whenever the context files change (i.e., on each new deployment of the application).

        Activity

        Hide
        Lars Kühne added a comment -

        Instead of developers having to manually upgrade a version number (which is easy to forget), it would often be preferable to build a checksum that covers all files in the web context, so the checksum changes whenever the context changes in any way. The URLs would then look like "/app-assets/d5f3459367ef/images/logo.gif". In our T4 app I did this by overriding the relevant Hivemind services. The context checksum is calculated once during application startup. This was quite simple to implement, and it works really well even from within the IDE because it does not require any build magic.

        For very large contexts with thousands of files your manual approach might be preferable to avoid the startup overhead, but for small contexts that overhead is well below one second and the approach is less error prone. It would be great if you could allow overriding the way the "version number" / checksum is defined.

        Show
        Lars Kühne added a comment - Instead of developers having to manually upgrade a version number (which is easy to forget), it would often be preferable to build a checksum that covers all files in the web context, so the checksum changes whenever the context changes in any way. The URLs would then look like "/app-assets/d5f3459367ef/images/logo.gif". In our T4 app I did this by overriding the relevant Hivemind services. The context checksum is calculated once during application startup. This was quite simple to implement, and it works really well even from within the IDE because it does not require any build magic. For very large contexts with thousands of files your manual approach might be preferable to avoid the startup overhead, but for small contexts that overhead is well below one second and the approach is less error prone. It would be great if you could allow overriding the way the "version number" / checksum is defined.

          People

          • Assignee:
            Howard M. Lewis Ship
            Reporter:
            Howard M. Lewis Ship
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development