【发布时间】:2016-03-07 12:37:30
【问题描述】:
我将 OmniFaces 2.2 与 PrimeFaces 5.3 和 BootsFaces 0.8.1 一起使用。由于建议将CombinedResourceHandler 与 BootsFaces 一起使用,因此我尝试按照 BootsFaces 说明首先使用: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>
在我的应用程序中,我使用自己的 JS 库并在我的布局/模板 XHTML 的 <h:head> 中拥有自己的 CSS 内容。
<h:outputStylesheet library="css" name="custom.css"/>
<h:outputScript library="scripts" name="js/custom_scripts.js" target="head"/>
CombinedResourceHandler 在faces-config 中启用。该应用程序处于Production 模式,并且在每个页面上的每次重新加载时,页面加载都会花费大量时间来下载组合的 css 和 js 文件,如您在附图中所见:
所以整个页面加载量是没有CombinedResourceHandler 的两倍到三倍。我唯一能想象的是我完全错误地使用它。但我的失败在哪里?
【问题讨论】:
-
showcase.omnifaces.org/resourcehandlers/CombinedResourceHandler 文档说使用
org.omnifaces.COMBINED_RESOURCE_HANDLER_CACHE_TTL。用它替换所有这些参数。你到底是从哪里弄来的? -
@BalusC 我从这里得到它showcase.bootsfaces.net/integration/OmniFaces.jsf
-
哦,这仅适用于您按照说明手动修改 OmniFaces 时。这不再是必需的,因为它已被添加到 OmniFaces 2.1 中(并且经过改进/简化,因此只需要 1 个参数)。
-
啊,好吧。杰普我把它换了。现在效果好多了:) 谢谢!
标签: jsf caching omnifaces bootsfaces combinedresourcehandler