OmniFaces CombinedResourceHandler takes long time to load

236 views Asked by At

I use OmniFaces 2.2 togehter with PrimeFaces 5.3 and BootsFaces 0.8.1. Since it is recomended to use CombinedResourceHandler with BootsFaces I tried to use first as per BootsFaces instructions: http://showcase.bootsfaces.net/integration/OmniFaces.jsf

<context-param>
    <param-name>org.omnifaces.COMBINED_RESOURCE_ACTIVATE_RESOURCE_CACHING</param-name>
    <param-value>true</param-value>
</context-param>
<context-param>
    <param-name>org.omnifaces.CACHE_SETTING_APPLICATION_MAX_CAPACITY</param-name>
    <param-value>30</param-value>
</context-param>
<context-param>
    <param-name>org.omnifaces.CACHE_SETTING_APPLICATION_TTL</param-name>
    <param-value>86400</param-value>
</context-param>

In my application I use my own JS libary and own CSS stuff inside the <h:head> of my layout/template XHTML.

<h:outputStylesheet library="css" name="custom.css"/>
<h:outputScript library="scripts" name="js/custom_scripts.js" target="head"/>

The CombinedResourceHandler is enabled inside the faces-config. The application is in Production mode and on every reload on every page the pageload takes much time to download the combined css and js files as you can see in the attached image:

Pageload

So the whole pageload is double to three times higher than without the CombinedResourceHandler. The only thing I can imagine is that I am using it completely wrong. But where is my failure?

1

There are 1 answers

1
BalusC On BEST ANSWER

Those context parameters are not correct. Those are only applicable when you modify OmniFaces 2.0 as per BootsFaces own instructions.

Since OmniFaces 2.1, the solution was integrated as per issue 100 and code and configuration have been simplified so that only the below context parameter is necessary in order to enable combined resource handler cache:

<context-param>
    <param-name>org.omnifaces.COMBINED_RESOURCE_HANDLER_CACHE_TTL</param-name>
    <param-value>86400</param-value>
</context-param>

See also the documentation on the CombinedResourceHandler showcase.