Version 1

    Support for generated resources in the RichFaces.

    RichFaces skins and components requires a lot of dynamically created resources ( stylesheets, images, scripts ), so static JSF-2.0 implementation should be extended to allow framework create resources on the fly.

    To achieve that, framework should register ResourceHandlerWrapper implementation that delegates requests for RF objects to the framework and pass others to the parent.

    Each resource has to have its own logical name in the Richfaces library. No additional parameters or other implementation-specific information should be used here. That allows to use logical names in the specification compatible way everywhere : in the JSF components  h:loadScript/h:loadStyle, Renderer annotations, and in the CSS files that processed by EL-parser. It hides implementation from components and allows to use short urls ( no more parameters with data rendered into it !). For compatibility with the rest of JSF framework, logical resource names should have appropriate extentions : .gif/.jpg./.png for images, .css for styles and .js for scripts.

    ResourceHandlerWrapper looks for requested resource in this order:

    1. For each getResource call, RF ResourceHandlerWrapper should calls corresponded method in the parent handler. If it returns existed resource object, it will be used without addition actions. That allows developers to simple replace our resources by static ones, just by standard JSF implementation ( /resources/ folder in the application context or META-INF/resources in jars ). That feature often requested for performance reasons or for the compatibility with some environment like Google AppEngine.

    2. If resource was not found on the first step, our ResourceHandler should ask parent for resource in the same library with '.properties' extension added to the name. If such resource was found by the parent handler, our implementation should read its content for additional information such as resource implementation class and optional parameters, and create resource based on that. Using parent handler allow us to not duplicate significant part of code and leverage features like versioning and localization. Because resource descriptor is simple properties file, web designers could easy tune application look and feel without changing the Java code.

     

    4. If all previous attempts fall, the last resort is attempt to load resource named 'factory.properties' in the same library. That file should contain Java class name for the factory that creates all resources in the library.