The previous post was incomplete, becaue lack of time. So lets finish. Implementation of DefaultFaceletFactory in mojara jsf2 as well as the whole jsf2 not implies, that DefaultFaceletFactory may be subclassed. The set of changes from 1.x complicate sucj kind of customization - getters for compiler and cache field were removed.
To achive desirable result and substitute the DefaultFaceletFactory with devived class need to make a small dirty hack. First of all create or use any existing reflection util to access the private field in parent class. Second subclass DefaultFaceletFactory with following constructor
public class MultiStoreFaceletFactory extends DefaultFaceletFactory {
/**
* Construct subclass of {@link DefaultFaceletFactory}
* @param root parent to decorate
* @throws IOException in case of error
*/
public MultiStoreFaceletFactory(final FaceletFactory root) throws IOException {
super(
(Compiler) ReflUtil.getFieldValue(DefaultFaceletFactory.class, root, "compiler"),
((DefaultFaceletFactory) root).getResourceResolver(),
-1,
(FaceletCache) ReflUtil.getFieldValue(DefaultFaceletFactory.class, root, "cache") );
// Your code is here
}
// Your code is here
}