Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You basically need a custom <a href="http://docs.oracle.com/javaee/6/api/javax/faces/application/ResourceHandler.html?is-external=true" rel="nofollow noreferrer">resource handler</a> which returns the desired external URL on <code>Resource#getRequestPath()</code> whenever the resource <code>primefaces:jquery/jquery.js</code> is been requested.</p> <p>E.g.</p> <pre><code>public class CDNResourceHandler extends ResourceHandlerWrapper { private ResourceHandler wrapped; public CDNResourceHandler(ResourceHandler wrapped) { this.wrapped = wrapped; } @Override public Resource createResource(final String resourceName, final String libraryName) { final Resource resource = super.createResource(resourceName, libraryName); if (resource == null || !"primefaces".equals(libraryName) || !"jquery/jquery.js".equals(resourceName)) { return resource; } return new ResourceWrapper() { @Override public String getRequestPath() { return "http://mydomain.com/jquery/jquery.js"; } @Override public Resource getWrapped() { return resource; } }; } @Override public ResourceHandler getWrapped() { return wrapped; } } </code></pre> <p>To get it to run, map it in <code>faces-config.xml</code> as follows:</p> <pre><code>&lt;application&gt; &lt;resource-handler&gt;com.example.CDNResourceHandler&lt;/resource-handler&gt; &lt;/application&gt; </code></pre> <p>The JSF utility library <a href="http://omnifaces.org" rel="nofollow noreferrer">OmniFaces</a> offers a reusable solution in flavor of <a href="http://showcase.omnifaces.org/resourcehandlers/CDNResourceHandler" rel="nofollow noreferrer"><code>CDNResourceHandler</code></a> which is in your case to be configured as</p> <pre><code>&lt;context-param&gt; &lt;param-name&gt;org.omnifaces.CDN_RESOURCE_HANDLER_URLS&lt;/param-name&gt; &lt;param-value&gt;primefaces:jquery/jquery.js=http://mydomain.com/jquery/jquery.js&lt;/param-value&gt; &lt;/context-param&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload