Search code examples
jsfjsf-2omnifacescombinedresourcehandler

Omnifaces CombinedResourceHandler -- Is there a way to suppress certain resources?


I'm using Omnifaces 1.0 in conjunction with Richfaces 4.0. Typically, I suppress some of the css/js included by Richfaces as it's unnecessary and unwieldy. I do this by definiing a custom renderer for the renderer-type javax.faces.resource.Script or javax.faces.resource.Stylesheet.

When I enable org.omnifaces.resourcehandler.CombinedResourceHandler some of the previously suppressed CSS seems to be getting combined. Is there a way to define assets that I would like to have excluded from the ResourceHandler?


Solution

  • This feature is not provided, but it is theoretically possible by supplying a special context parameter and changing the CombinedResourceHandler to exclude them from being combined.

    Something like:

    <context-param>
        <param-name>org.omnifaces.COMBINED_RESOURCE_HANDLER_EXCLUDED_RESOURCES</param-name>
        <param-value>libraryName:resourceName1.ext,libraryName:resourceName2.ext</param-value>
    </context-param>
    

    Alternatively, another possibility would be to actually suppress them so that you don't need custom renderer to suppress them afterwards:

    <context-param>
        <param-name>org.omnifaces.COMBINED_RESOURCE_HANDLER_SUPPRESSED_RESOURCES</param-name>
        <param-value>libraryName:resourceName1.ext,libraryName:resourceName2.ext</param-value>
    </context-param>
    

    If you open a new feature request, then it will likely be implemented.