GateIn cacheable skin URL

Version 1

    Status

     

    WIP by Julien Viet and VN team.

     

    Introduction

     

    The goal is to make GateIn URL for skin resources cacheable according to the context, it will provide several benefits:

     

    • The life of a skin css can be very long and today it is only one hour
    • A skin will be represented uniquely with one URL (previously the minified version and original version were served with the same URL)
    • It allows to version skins with the product version providing a seamless product upgrade for user agents (i.e people will not have to clear their browser cache sometimes)

     

    Specification

    URL composition

     

    To achieve cacheability we will include the following items in the URL:

     

    • version
    • minified status
    • path

     

    For instance /portal/skin/3.4.0.Final-SNAPSHOT/eXoResources/skin/Stylesheet-lt-min.css contains the version 3.4.0.Final-SNAPSHOT, the minified status min and the path eXoResources/skin/Stylesheet.

     

    Resource serving

     

    As of today, skins are served from the ResourceRequestFilter and it will have its own integration with the navigation controller service as SkinResourceRequestHandler (the filter remains as it is also used for serving images). The navigation controller will be leveraged with a route like:

     

      <route path="/skins/{gtn:version}/{gtn:resource}{gtn:compress}.css">
        <route-param qname="gtn:handler">
          <value>skin</value>
        </route-param>
        <path-param qname="gtn:version" encoding="preserve-path">
          <pattern>[^/]*</pattern>
        </path-param>
        <path-param qname="gtn:compress" capture-group="true">
          <pattern>-(min)|</pattern>
        </path-param>
                <path-param qname="gtn:resource" encoding="preserve-path">
          <pattern>.+?</pattern>
                </path-param>
      </route>
    
    

     

    It is important to notice that the -lt and -rt will not be managed by the navigation controller for the sake of simplicity (but could later) and due to lack of time (less changes / less bugs).

    Minification

     

    Previously a single URL was used for both version and when the resource was rendered the current development mode was used or not for minifying/merging resources (actually this was preventing real cacheability of skin as resources).

     

    This changes as now the URL defines which flag should be used for rendering the resource and now the minification flag is used when the URL is produced instead of when the resource is rendered.