*/
@Override
public void apply(FaceletContext faceletCtx, UIComponent parent) throws IOException, FacesException, ELException {
hookAboutToApply(faceletCtx, parent);
FaceletContextImplBase ctx = (FaceletContextImplBase) faceletCtx;
VariableMapper orig = ctx.getVariableMapper();
if (this.params != null || this.vars.length > 0) {
VariableMapper varMapper = new VariableMapperWrapper(orig);
ctx.setVariableMapper(varMapper);
if (this.params != null) {
for (ParamHandler param : this.params) {
param.apply(ctx, parent);
}
}
// setup a variable map
if (this.vars.length > 0) {
for (TagAttribute var : this.vars) {
varMapper.setVariable(var.getLocalName(),
var.getValueExpression(ctx, Object.class));
}
}
}
ctx.pushClient(this);
try {
// hook
InputStream is = hookInputStreamToApply();
initialize();
// this unfortunately does not work
// DefaultFaceletCache cache = new DefaultFaceletCache(afCacheTime);
LiteFaceletFactory factory = new LiteFaceletFactory(originalCompiler, new DefaultResourceResolver(), afCacheTime, originalCache);
// force the originalIdMappers
setIdMappers(factory, originalIdMappers);
Facelet facelet = factory.getFacelet(is, getAlias());
// this unfortunately does not work
Method m = getIncludeMethod(facelet);
m.invoke(facelet, ctx, parent);
hookApplyOver(faceletCtx, parent);
} catch (Exception e) {
throw new FaceletException(e);
} finally {
ctx.setVariableMapper(orig);
ctx.popClient(this);
}
}