Since Mojarra/JSF 2.2. it is not possible anymore to provide a custom FaceletFactory
using a web.xml
context parameter:
<context-param>
<param-name>com.sun.faces.faceletFactory</param-name>
<param-value>my.faces.overrides.MyFaceletFactory</param-value>
</context-param>
My application provides some CMS features, including virtual host support to serve different pages (facelets) based on the currently requested domain. So http://www.domain1.com/index.xhtml
returns different content than http://www.otherdomain.com/index.xhtml
. The mechanics behind that are not that big of a deal using a custom resource resolver. The real problem when doing that is, that jsf caches the facelets only based on its requested uri, which does not contain the host name ("/index.xhtml"
in both cases). I worked around this issue by simply adding the host name to it in my custom FaceletFactory
: uri = "/" + getCleanHostName() + "://" + uri;
. With JSF 2.2, this does not seem possible anymore. Is there any other way to archive the correct caching behavior in JSF 2.2? Disabling the faces cache is not an option due to its performance impact.