question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OmniFaces CombinedResourceHandler PF Convenience Classes

See original GitHub issue

We heavily use the Omnifaces CombinedResourceHandler to combine our CSS and JS to just 1 script each in our PrimeFaces apps.

See: https://showcase.omnifaces.org/resourcehandlers/CombinedResourceHandler

However PrimeFaces hard codes some resources in the HeadRenderer which leave it outside the scope of being combined like the theme.css, beanvalidation.js etc etc.

Of course @BalusC has an excellent solution provided on his WIKI here: https://github.com/omnifaces/omnifaces/wiki/Combine-hardcoded-PrimeFaces-resources-using-CombinedResourceHandler

So rather than make people copy and paste and change with every PF version I thought I would include the classes here for PrimeFaces Extensions starting with 10.0.

faces-config.xml

<application>
    <system-event-listener>
        <system-event-listener-class>org.primefaces.extensions.application.PrimeFacesScriptProcessor</system-event-listener-class>
        <system-event-class>javax.faces.event.PostAddToViewEvent</system-event-class>
        <source-class>javax.faces.component.UIViewRoot</source-class>
     </system-event-listener>
</application>

<lifecycle>
    <phase-listener>org.primefaces.extensions.application.PrimeFacesResourceProcessor</phase-listener>
</lifecycle>

Don’t forget to disable PF’s HeadRenderer:

<render-kit>
    <renderer>
        <component-family>javax.faces.Output</component-family>
        <renderer-type>javax.faces.Head</renderer-type>
        <renderer-class>com.sun.faces.renderkit.html_basic.HeadRenderer</renderer-class>
    </renderer>
</render-kit>

In case you’re using MyFaces, use org.apache.myfaces.renderkit.html.HtmlHeadRenderer as <renderer-class>.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
stolpcommented, Jan 29, 2021

Tested this (without CKEditor) and it is working flawlessly in my application. Thanks a lot!

Read more comments on GitHub >

github_iconTop Results From Across the Web

CombinedResourceHandler - OmniFaces Showcase
The combined resource content is by default cached in an application scoped cache in heap space. This can be customized as per instructions...
Read more >
maven - OmniFaces ClassNotFoundException ...
... need the CombinedResourceHandler . It's just a great tool to speed up your application until http/2 arrives. For the sake of convenience...
Read more >
OmnifacesProperties (JoinFaces 4.7.5 API) - Index of
Class <?> getCacheProvider(). org.omnifaces.CACHE_PROVIDER. java.lang.Integer, getCacheSettingApplicationMaxCapacity(). Sets the maximum number of elements ...
Read more >
CombinedResourceHandler - javadoc.io
org.omnifaces.resourcehandler. Class CombinedResourceHandler. java.lang.Object extended by javax.faces.application.ResourceHandler extended by ...
Read more >
JSF Performance Tuning | techscouting through the java news
The xhtml definition is parsed and an instance of the component class is ... to describe in detail is offered by OmniFaces: The...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found