private DelegatingVariableMapper getDelegatingVariableMapper(FaceletContext context) { VariableMapper variableMapper = context.getVariableMapper(); if (variableMapper instanceof DelegatingVariableMapper) { return (DelegatingVariableMapper) variableMapper; } DelegatingVariableMapper delegatingVariableMapper = new DelegatingVariableMapper(variableMapper); context.setVariableMapper(delegatingVariableMapper); return delegatingVariableMapper; }
private DelegatingVariableMapper getDelegatingVariableMapper(FaceletContext context) { VariableMapper variableMapper = context.getVariableMapper(); if (variableMapper instanceof DelegatingVariableMapper) { return (DelegatingVariableMapper) variableMapper; } DelegatingVariableMapper delegatingVariableMapper = new DelegatingVariableMapper(variableMapper); context.setVariableMapper(delegatingVariableMapper); return delegatingVariableMapper; }
public void apply(FaceletContext ctx, UIComponent parent, String nameStr, ValueExpression valueVE) throws IOException, FacesException, FaceletException, ELException { ctx.getVariableMapper().setVariable(nameStr, valueVE); AbstractFaceletContext actx = ((AbstractFaceletContext) ctx); actx.getTemplateContext().setAllowCacheELExpressions(false); }
public void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException, ELException { String nameStr = this.name.getValue(ctx); ValueExpression valueVE = this.value.getValueExpression(ctx, Object.class); ctx.getVariableMapper().setVariable(nameStr, valueVE); }
public void apply(FaceletContext ctx, UIComponent parent) throws IOException { String nameStr = this.name.getValue(ctx); ValueExpression valueVE = this.value.getValueExpression(ctx, Object.class); ctx.getVariableMapper().setVariable(nameStr, valueVE); }
@Override public void setFaceletContext(FaceletContext faceletContext) { if (DEFAULT_SCOPE.equals(getScope())) { readOnlyValueExpression = new ReadOnlyValueExpression(UIComponent.class); faceletContext.getVariableMapper().setVariable(getName(), readOnlyValueExpression); } }
@Override public void setFaceletContext(FaceletContext faceletContext) { if (DEFAULT_SCOPE.equals(getScope())) { readOnlyValueExpression = new ReadOnlyValueExpression(UIComponent.class); faceletContext.getVariableMapper().setVariable(getName(), readOnlyValueExpression); } }
@Override public void apply(FaceletContext ctx, UIComponent parent) throws IOException { String nameStr = this.name.getValue(ctx); ValueExpression valueVE = this.value.getValueExpression(ctx, Object.class); ctx.getVariableMapper().setVariable(nameStr, valueVE); }
@Override public void apply(FaceletContext ctx, UIComponent parent) throws IOException { String nameStr = this.name.getValue(ctx); ValueExpression valueVE = this.value.getValueExpression(ctx, Object.class); ctx.getVariableMapper().setVariable(nameStr, valueVE); }
public void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException, ELException { String nameStr = this.name.getValue(ctx); ValueExpression valueVE = this.value.getValueExpression(ctx, Object.class); ctx.getVariableMapper().setVariable(nameStr, valueVE); }
@Override public void apply(FaceletContext ctx, UIComponent parent) throws IOException { String nameStr = this.name.getValue(ctx); ValueExpression valueVE = this.value.getValueExpression(ctx, Object.class); ctx.getVariableMapper().setVariable(nameStr, valueVE); }
private ValueExpression getExpression(final FaceletContext faceletContext) { final String myValue = removeElParenthesis(value.getValue()); return faceletContext.getVariableMapper().resolveVariable(myValue); }
@Override public void apply(FaceletContext ctx, UIComponent parent) throws IOException { Cache cacheComponent; if (parent instanceof Cache) { cacheComponent = (Cache) parent; } else { throw new IllegalStateException("CacheValue components needs to have a Cache component as direct parent."); } String nameStr = name.getValue(ctx); // The original value expression we get inside the Facelets tag ValueExpression valueExpression = value.getValueExpression(ctx, Object.class); ctx.getVariableMapper().setVariable(nameStr, new CachingValueExpression(nameStr, valueExpression, cacheComponent)); } }
@Override public void apply(FaceletContext ctx, UIComponent parent) throws IOException { Cache cacheComponent; if (parent instanceof Cache) { cacheComponent = (Cache) parent; } else { throw new IllegalStateException("CacheValue components needs to have a Cache component as direct parent."); } String nameStr = name.getValue(ctx); // The original value expression we get inside the Facelets tag ValueExpression valueExpression = value.getValueExpression(ctx, Object.class); ctx.getVariableMapper().setVariable(nameStr, new CachingValueExpression(nameStr, valueExpression, cacheComponent)); } }
@Override public void apply(FaceletContext ctx, UIComponent parent) throws IOException { String nameStr = name.getValue(ctx); // The original value expression we get inside the Facelets tag, that's actually the method expression passed-in by the user. ValueExpression valueExpression = value.getValueExpression(ctx, Object.class); // A method expression that wraps the value expression and uses its own invoke method to get the value from the wrapped expression. MethodExpression methodExpression = new MethodExpressionValueExpressionAdapter(valueExpression); // Using the variable mapper so the expression is scoped to the body of the Facelets tag. Since the variable mapper only accepts // value expressions, we once again wrap it by a value expression that directly returns the method expression. ValueExpression valueExpressionWrapper = ctx.getExpressionFactory().createValueExpression(methodExpression, MethodExpression.class); ctx.getVariableMapper().setVariable(nameStr, valueExpressionWrapper); }
@Override public void apply(FaceletContext ctx, UIComponent parent) throws IOException { String nameStr = name.getValue(ctx); // The original value expression we get inside the Facelets tag, that's actually the method expression passed-in by the user. ValueExpression valueExpression = value.getValueExpression(ctx, Object.class); // A method expression that wraps the value expression and uses its own invoke method to get the value from the wrapped expression. MethodExpression methodExpression = new MethodExpressionValueExpressionAdapter(valueExpression); // Using the variable mapper so the expression is scoped to the body of the Facelets tag. Since the variable mapper only accepts // value expressions, we once again wrap it by a value expression that directly returns the method expression. ValueExpression valueExpressionWrapper = ctx.getExpressionFactory().createValueExpression(methodExpression, MethodExpression.class); ctx.getVariableMapper().setVariable(nameStr, valueExpressionWrapper); }
@Override public void apply(FaceletContext ctx, UIComponent parent) throws IOException { String path = this.src.getValue(ctx); if (path == null || path.length() == 0) { return; } VariableMapper orig = ctx.getVariableMapper(); ctx.setVariableMapper(new VariableMapperWrapper(orig)); try { this.nextHandler.apply(ctx, null); WebConfiguration webConfig = WebConfiguration.getInstance(); if (path.startsWith(webConfig.getOptionValue(WebConfiguration.WebContextInitParameter.WebAppContractsDirectory))) { throw new TagAttributeException(this.tag, this.src, "Invalid src, 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.src, "Invalid path : " + path); } finally { ctx.setVariableMapper(orig); } } }
public void apply(FaceletContext ctx, final UIComponent parent, String templatePath) throws IOException { FaceletContextImplBase faceletContextImpl = (FaceletContextImplBase) ctx; VariableMapper originalVariableMapper = ctx.getVariableMapper(); if (this.paramHandlers != null) { ctx.setVariableMapper(new VariableMapperWrapper(originalVariableMapper)); for (ParamHandler paramHandler : this.paramHandlers) { paramHandler.apply(ctx, parent); } } TemplateClient client = new TemplateClient() { public boolean apply(FaceletContext ctx, UIComponent parent, String name) throws IOException { return applyTemplate(ctx, parent, name); } }; faceletContextImpl.pushClient(client); try { ctx.includeFacelet(parent, templatePath); } finally { faceletContextImpl.popClient(client); faceletContextImpl.setVariableMapper(originalVariableMapper); } }
public void apply(FaceletContext ctx, final UIComponent parent, String templatePath) throws IOException { AbstractFaceletContext faceletContextImpl = (AbstractFaceletContext) ctx; VariableMapper originalVariableMapper = ctx.getVariableMapper(); if (this.paramHandlers != null) { ctx.setVariableMapper(new VariableMapperWrapper(originalVariableMapper)); for (ParamHandler paramHandler : this.paramHandlers) { paramHandler.apply(ctx, parent); } } TemplateClient client = new TemplateClient() { public boolean apply(FaceletContext ctx, UIComponent parent, String name) throws IOException { return applyTemplate(ctx, parent, name); } }; faceletContextImpl.pushClient(client); try { ctx.includeFacelet(parent, templatePath); } finally { faceletContextImpl.popClient(client); faceletContextImpl.setVariableMapper(originalVariableMapper); } }
public void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException, ELException { VariableMapper orig = ctx.getVariableMapper(); if (_params != null) { VariableMapper vm = new VariableMapperWrapper(orig); ctx.setVariableMapper(vm); for (int i = 0; i < _params.length; i++) { _params[i].apply(ctx, parent); } } AbstractFaceletContext actx = (AbstractFaceletContext) ctx; actx.pushClient(this); try { ctx.includeFacelet(parent, _template.getValue(ctx)); } finally { ctx.setVariableMapper(orig); actx.popClient(this); } }