Question

when using CombinedResourceHandler in a Richfaces application only stylesheets and user defiend scripts are combined. The standard JavaScript resource and all Richfaces specific resources remain as seperated resources.

The Omnifaces documentation states:

RichFaces has the same problem with several JS files, but this is so far not exactly trivial to workaround

So my question is what this 'non-trivial workaround' would be?

As far as I can see, CombinedResourceHandler wont handle resources when getRendererType() returns org.richfaces.renderkit.ResourceLibraryRenderer. These are then handled by org.richfaces.renderkit.html.ResourceLibraryRenderer.

I am not sure what would be the best way to combine RichFaces behaviour with OmniFaces here.

Was it helpful?

Solution

I was able to create a solution by modifying OmniFaces CombinedResourceHandler.

Details in short:

Richfaces utilizes a concept called ResourceLibrarys wich means a resource may not only be a single file but instead a collection of those files. For example, RichFaces uses a resource named base-component.reslib. RichFaces ResourceHandler interpretes this resource dependency as dependency to

  • javax.faces:jsf.js
  • jquery.js
  • richfaces.js
  • richfaces-base-component.js

So the CombinedResourceHandler needed some extra functionality to seperate dependencies to ordinary Resources from Richfaces ResourceLibraries. The latter needed to be resolved according to specifications obtained from RichFaces sources.

OTHER TIPS

It was not trivial to work this around without modifying the CombinedResourceHandler itself. The CombinedResourceHandler itself has really to be modified to use a reflection hack which extracts the resources from RichFaces' org.richfaces.resource.ResourceLibraryFactoryImpl. The reflection hack is necessary in order to keep OmniFaces free of RichFaces dependencies so that it can be used together with other component libraries like PrimeFaces.

As per issue 107, this was implemented in 1.3-20121206.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top