public static Object makeExpressionPayload ( String expr ) throws IllegalArgumentException, IllegalAccessException, Exception { FacesContextImpl fc = new FacesContextImpl((ServletContext) null, (ServletRequest) null, (ServletResponse) null); ELContext elContext = new FacesELContext(new CompositeELResolver(), fc); Reflections.getField(FacesContextImplBase.class, "_elContext").set(fc, elContext); ExpressionFactory expressionFactory = ExpressionFactory.newInstance(); ValueExpression ve1 = expressionFactory.createValueExpression(elContext, expr, Object.class); ValueExpressionMethodExpression e = new ValueExpressionMethodExpression(ve1); ValueExpression ve2 = expressionFactory.createValueExpression(elContext, "${true}", Object.class); ValueExpressionMethodExpression e2 = new ValueExpressionMethodExpression(ve2); return Gadgets.makeMap(e2, e); }
private void applyActionMethodExpressionTarget(FacesContext context, FaceletCompositionContext mctx, ELContext elContext, UIComponent topLevelComponent, UIComponent innerComponent, String attributeName, String targetAttributeName, String attributeExpressionString, ValueExpression attributeNameValueExpression, boolean ccAttrMeRedirection) { // target is ActionSource2 MethodExpression methodExpression = reWrapMethodExpression(context.getApplication().getExpressionFactory(). createMethodExpression(elContext, attributeExpressionString, null, EMPTY_CLASS_ARRAY), attributeNameValueExpression); // If it is a redirection, a wrapper is used to // locate the right instance and call it properly. if (ccAttrMeRedirection) { ((ActionSource2) innerComponent).setActionExpression( new ValueExpressionMethodExpression(attributeNameValueExpression)); } else { ((ActionSource2) innerComponent).setActionExpression(methodExpression); } }
new ValueExpressionMethodExpression(attributeNameValueExpression));
methodExpression = new ValueExpressionMethodExpression(valueExpr);
methodExpression = new ValueExpressionMethodExpression(valueExpr);
methodExpression = new ValueExpressionMethodExpression(valueExpr);