我在我的pom.xml中将OmniFaces版本从1.8.1更新到2.0。当我启动应用程序时,资源不再解析为有效的URL。
使用OmniFaces 1.8.1:
<link type="text/css" rel="stylesheet" href="https://somedomain.com/style.css" />
<script type="text/javascript" src="https://somedomain.com/omnifaces/fixviewstate.js">
</script>
使用OmniFaces 2.0:
<link type="text/css" rel="stylesheet" href="RES_NOT_FOUND"/>
<script type="text/javascript" src="https://somedomain.com/omnifaces/fixviewstate.js">
视图的片段xhtml:
<h:outputStylesheet library="publiclib" name="style.css"/>
<h:outputScript library="omnifaces" name="fixviewstate.js" target="head"/>
faces-config.xml的片段:
<application>
<resource-handler>
org.omnifaces.resourcehandler.UnmappedResourceHandler
</resource-handler>
<resource-handler>
org.omnifaces.resourcehandler.CDNResourceHandler
</resource-handler>
</application>
web.xml的片段:
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Production</param-value>
</context-param>
<context-param>
<param-name>org.omnifaces.CDN_RESOURCE_HANDLER_URLS</param-name>
<param-value>
publiclib:*=https://somedomain.com/*,
omnifaces:*=https://somedomain.com/omnifaces/*,
</param-value>
</context-param>
<context-param>
<param-name>org.primefaces.extensions.DELIVER_UNCOMPRESSED_RESOURCES</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>org.omnifaces.CDN_RESOURCE_HANDLER_ALWAYS_ENABLED</param-name>
<param-value>true</param-value>
</context-param>
应用程序在带有PrimeFaces 5.1的WildFly 8.2上运行