2 Replies Latest reply on Apr 2, 2014 1:39 PM by Brian Leathem

    ScriptStyleBaseRenderer and fingerprinting

    Elijah Baley Newbie


      We have scripts and css resources currently versioned with ?ver=XYZ123 by extending ScriptStyleBaseRenderer. (RF 4.2.2 Final) We would like instead to finger-print the resources. On the build side we'd like to use wro4j. it produces a mapping file similar to how RF does it: alias=fingerprinted-file.


      I was thinking at first that I would check wromapping.properties if the file has been remapped. And if so, write out the wro'ed url, otherwise do the default RF lookup:

      Resource resource = context.getApplication().getResourceHandler().createResource(name, library);


      But this would skip some steps of default RF resource handler, the dup checking, dependency checking, caching? What should the flow be? Is there a way to customize the resource loader/factory? Do I need to do that?


      Has anyone already attempted this?

        • 1. Re: ScriptStyleBaseRenderer and fingerprinting
          Elijah Baley Newbie

          I checked into this further, it is possible to re-implement ResourceFactoryImpl with this:





          and then in ExtendedResourceHandlerImpl constructor do:

          this.resourceFactory = new ExtendedResourceFactoryImpl(defaultHandler);


          This would allow me to change which mapping files are being loaded. It's a copy/paste of those two classes in their entirely because of how they are written in 4.2.2.Final. (I see that they were refactored in 4.3.3).  But instead, I think i will just copy over everything from /META-INF/richfaces/staticResourceMapping/Packed.properties into my user configured mapping file defined in web.xml


          @ConfigurationItem(names = "org.richfaces.resourceMapping.mappingFile")









          Do you see any problems with that?

          • 2. Re: ScriptStyleBaseRenderer and fingerprinting
            Brian Leathem Master

            Sounds reasonable, let us know how it works out, and if ther are any further extension points that need to be provided.