带有CDN的JSF 2资源? [英] JSF 2 resources with CDN?

查看:117
本文介绍了带有CDN的JSF 2资源?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我了解,对JSF 2资源的需求是帮助组织资源目录,并添加一些版本控制和本地化.

As i understand it, the needs for JSF 2 resources is to help organizing resources directories, and add some versioning and localization.

但是可以将此功能与CDN结合使用吗?我以前从未使用过CDN,但是它看起来不错,并且希望听到您对此的想法以及与JSF 2资源的可能组合,尽管我认为这不太可能.

But is it possible to combine this feature with a CDN ? I've never used CDN before, but it looks good, and would like to hear your ideas about it and possible combinations with JSF 2 resources, although i dont think it's likely.

推荐答案

对于<h:outputScript><h:outputStylesheet>,这是不可能的,因为它们只能指向webapp自身的资源,而不能指向外部URL. JSF家伙已经要求使用此功能.另请参见 JSF规范598 .目前,它计划在2.2发行,但我不希望它现在已经实现,因为它目前处于0票状态.

This is not possible with <h:outputScript> and <h:outputStylesheet> yet, as they can only point to webapp's own resources, not to an external URL. This feature has already been requested to the JSF guys. See also JSF spec issue 598. Right now it's scheduled for 2.2, but I don't expect it to be already implemented then as it's currently at 0 votes.

在此之前,您需要使用<h:head>中的纯HTML <link><script>自己指定它们.必要时可以确定模板定义.一定要在每个视图的基础上进行定义.

Until then, you'd need to specify them yourself using plain HTML <link> and <script> in <h:head>. You could make it a template definition if necessary, surely when you'd like to define them on a per-view basis.

<h:head>
    ...
    <ui:insert name="resources" />
</h:head>

<ui:define name="resources">
    <link rel="stylesheet" type="text/css" src="http://.../foo.css" />
    <script type="text/javascript" src="http://.../foo.js"></script>
</ui:define>


更新 JSF实用程序库 OmniFaces 自版本1.2起具有 CDNResourceHandler展示页面.


Update the JSF utility library OmniFaces has since version 1.2 a CDNResourceHandler available which could be used to automatically replace JSF resources by CDN resources when running in production stage. See also the CDNResourceHandler showcase page.

这篇关于带有CDN的JSF 2资源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆