* @see com.sun.facelets.FaceletHandler#apply(com.sun.facelets.FaceletContext,
* javax.faces.component.UIComponent)
*/
public void apply(FaceletContext ctxObj, UIComponent parent)
throws IOException {
FaceletContextImplBase ctx = (FaceletContextImplBase) ctxObj;
if (this.template != null) {
FacesContext facesContext = ctx.getFacesContext();
Integer compositionCount = (Integer) facesContext.getAttributes().get("com.sun.faces.uiCompositionCount");
if (compositionCount == null) {
compositionCount = 1;
} else {
compositionCount++;
}
facesContext.getAttributes().put("com.sun.faces.uiCompositionCount", compositionCount);
VariableMapper orig = ctx.getVariableMapper();
if (this.params != null) {
VariableMapper vm = new VariableMapperWrapper(orig);
ctx.setVariableMapper(vm);
for (int i = 0; i < this.params.length; i++) {
this.params[i].apply(ctx, parent);
}
}
ctx.extendClient(this);
String path = null;
try {
path = this.template.getValue(ctx);
if (path.trim().length() == 0) {
throw new TagAttributeException(this.tag, this.template, "Invalid path : " + path);
}
WebConfiguration webConfig = WebConfiguration.getInstance();
if (path.startsWith(webConfig.getOptionValue(WebConfiguration.WebContextInitParameter.WebAppContractsDirectory))) {
throw new TagAttributeException(this.tag, this.template, "Invalid path, contract resources cannot be accessed this way : " + path);
}
ctx.includeFacelet(parent, path);
} catch (IOException e) {
if (log.isLoggable(Level.FINE)) {
log.log(Level.FINE, e.toString(), e);
}
throw new TagAttributeException(this.tag, this.template, "Invalid path : " + path);
} finally {
ctx.popClient(this);
ctx.setVariableMapper(orig);
compositionCount = (Integer) facesContext.getAttributes().get("com.sun.faces.uiCompositionCount");
compositionCount--;
if (compositionCount == 0) {