/** * Set the ELContext used for parsing and evaluating EL expressions. * The supplied ELContext will not be modified, except for the context * object map. * @param context The new ELContext. * @return The previous ELContext, null if none. */ public ELContext setELContext(ELContext context) { ELContext prev = elContext; elContext = new StandardELContext(context); return prev; }
/** * Return the ELContext used for parsing and evaluating EL expressions. * If there is currently no ELContext, a default instance of * StandardELContext is returned. * * @return The ELContext used for parsing and evaluating EL expressions.. */ public StandardELContext getELContext() { if (elContext == null) { elContext = new StandardELContext(getExpressionFactory()); } return elContext; }
@Override public void executePolicy(String policyStatement, Errors.Collector collector, ProviderRequest request) { StandardELContext context = new StandardELContext(ef); context.addELResolver(ATTRIBUTE_RESOLVER); FunctionMapper functions = context.getFunctionMapper(); VariableMapper variables = context.getVariableMapper(); customMethods.forEach(customFunction -> functions.mapFunction(customFunction.prefix, customFunction.localName, customFunction.method)); Subject userSubject = request.subject().orElse(SecurityContext.ANONYMOUS); variable(variables, "user", userSubject, Subject.class); variable(variables, "subject", userSubject, Subject.class); variable(variables, "service", request.service().orElse(SecurityContext.ANONYMOUS), Subject.class); variable(variables, "env", request.env(), SecurityEnvironment.class); variable(variables, "object", request.getObject().orElse(null), Object.class); variable(variables, "request", request, ProviderRequest.class); try { ValueExpression expression = ef.createValueExpression(context, policyStatement, boolean.class); boolean value = (boolean) expression.getValue(context); if (!value) { collector.fatal(this, "Policy statement \"" + policyStatement + "\" evaluated to false"); } } catch (Exception e) { collector.fatal(this, "Policy statement \"" + policyStatement + "\" evaluated to an exception " + e.getClass() .getName() + " with message: " + e.getMessage()); LOGGER.log(Level.FINEST, e, () -> "Statement " + policyStatement + " evaluation failed"); } }
/** * Set the ELContext used for parsing and evaluating EL expressions. * The supplied ELContext will not be modified, except for the context * object map. * @param context The new ELContext. * @return The previous ELContext, null if none. */ public ELContext setELContext(ELContext context) { ELContext prev = elContext; elContext = new StandardELContext(context); return prev; }
public ELContext setELContext(ELContext context) { StandardELContext oldContext = this.context; this.context = new StandardELContext(context); return oldContext; }
/** * Set the ELContext used for parsing and evaluating EL expressions. * The supplied ELContext will not be modified, except for the context * object map. * @param context The new ELContext. * @return The previous ELContext, null if none. */ public ELContext setELContext(ELContext context) { ELContext prev = elContext; elContext = new StandardELContext(context); return prev; }
/** * Set the ELContext used for parsing and evaluating EL expressions. * The supplied ELContext will not be modified, except for the context * object map. * @param context The new ELContext. * @return The previous ELContext, null if none. */ public ELContext setELContext(ELContext context) { ELContext prev = elContext; elContext = new StandardELContext(context); return prev; }
/** * Set the ELContext used for parsing and evaluating EL expressions. * The supplied ELContext will not be modified, except for the context * object map. * @param context The new ELContext. * @return The previous ELContext, null if none. */ public ELContext setELContext(ELContext context) { ELContext prev = elContext; elContext = new StandardELContext(context); return prev; }
/** * Set the ELContext used for parsing and evaluating EL expressions. * The supplied ELContext will not be modified, except for the context * object map. * @param context The new ELContext. * @return The previous ELContext, null if none. */ public ELContext setELContext(ELContext context) { ELContext prev = elContext; elContext = new StandardELContext(context); return prev; }
public ELContext setELContext(ELContext context) { StandardELContext oldContext = this.context; this.context = new StandardELContext(context); return oldContext; }
public ELContext setELContext(ELContext context) { StandardELContext oldContext = this.context; this.context = new StandardELContext(context); return oldContext; }
/** * Set the ELContext used for parsing and evaluating EL expressions. * The supplied ELContext will not be modified, except for the context * object map. * @param context The new ELContext. * @return The previous ELContext, null if none. */ public ELContext setELContext(ELContext context) { ELContext prev = elContext; elContext = new StandardELContext(context); return prev; }
public StandardELContext getELContext() { if (context == null) { context = new StandardELContext(getExpressionFactory()); } return context; }
public StandardELContext getELContext() { if (context == null) { context = new StandardELContext(getExpressionFactory()); } return context; }
public StandardELContext getELContext() { if (context == null) { context = new StandardELContext(getExpressionFactory()); } return context; }
/** * Return the ELContext used for parsing and evaluating EL expressions. * If there is currently no ELContext, a default instance of * StandardELContext is returned. * * @return The ELContext used for parsing and evaluating EL expressions.. */ public StandardELContext getELContext() { if (elContext == null) { elContext = new StandardELContext(getExpressionFactory()); } return elContext; }
/** * Return the ELContext used for parsing and evaluating EL expressions. * If there is currently no ELContext, a default instance of * StandardELContext is returned. * * @return The ELContext used for parsing and evaluating EL expressions.. */ public StandardELContext getELContext() { if (elContext == null) { elContext = new StandardELContext(getExpressionFactory()); } return elContext; }
private void init() { final StandardELContext context = new StandardELContext(factory); functionMapper = context.getFunctionMapper(); variableMapper = context.getVariableMapper(); } }
@Override public ContractContext createContext(final Object instance, final Object[] arguments, final String[] parameterNames) { final ELContext elContext = new StandardELContext(expressionFactory); for (int index = 0; index < arguments.length; index++) { elContext.getVariableMapper().setVariable(parameterNames[index], expressionFactory.createValueExpression(arguments[index], arguments[index].getClass())); } elContext.getVariableMapper().setVariable(Clause.THIS, expressionFactory.createValueExpression(instance, instance.getClass())); return new ELContractContext(elContext, expressionFactory); }
public static ELContext createELContext(BeanManagerImpl beanManagerImpl) { StandardELContext context = new StandardELContext(EXPRESSION_FACTORY); context.addELResolver(beanManagerImpl.getELResolver()); callELContextListeners(context); return context; }