/** * Sets a variable which is then exposed to the view layer * * @param name * @param value * * @return */ public ThymeleafCall set(String name, Object value) { context.getVariables().put(name, value); return this; }
/** * Sets a variable which is then exposed to the view layer * * @param name * @param value * * @return */ public ThymeleafCall set(String name, Object value) { context.getVariables().put(name, value); return this; }
public ThymeleafCall template(final String name) { final IContext ctx = makeContext(); // Expose the service configuration ctx.getVariables().put("config", configuration); ctx.getVariables().putAll(data); return new ThymeleafCall(engine, ctx, name, calls, failures); }
private Object createEvaluationRoot() { final VariablesMap<String, Object> contextVariables = this.context.getVariables(); // We create a new VariablesMap instance using its constructor instead of cloning the existing one // because we want to avoid undesirable interactions like, for example, those that could happen // if we executed putAll on a WebVariablesMap object (which would add those variables to the HttpServletRequest // and therefore make them available to the whole page and not just the local variable scope). final VariablesMap<String,Object> newEvaluationRoot = new VariablesMap<String, Object>(contextVariables); if (this.localVariables != null) { newEvaluationRoot.putAll(this.localVariables); } return newEvaluationRoot; }
public ThymeleafCall template(final String name) { final IContext ctx = makeContext(); // Expose the service configuration ctx.getVariables().put("config", configuration); ctx.getVariables().putAll(data); return new ThymeleafCall(engine, ctx, name, calls, failures); }
protected Map<String, Object> computeAdditionalContextVariables(IProcessingContext processingContext) { Map<String, Object> var = new HashMap<>(); var.put(Routes.OBJECT_NAME, processingContext.getContext().getVariables().get(Routes.ROUTES_VAR)); final Context context = Context.CONTEXT.get(); if (context != null) { var.put("http", context); var.put("session", context.session()); var.put("flash", context.flash()); var.put("request", context.request()); var.put("parameters", context.parameters()); } return var; }
protected void setVariableRestrictions(final StandardExpressionExecutionContext expContext, final Object evaluationRoot, final Map<String,Object> contextVariables) { final List<IContextVariableRestriction> restrictions = (expContext.getForbidRequestParameters()? StandardVariableRestrictions.REQUEST_PARAMETERS_FORBIDDEN : null); final Object context = contextVariables.get(ExpressionEvaluatorObjects.CONTEXT_VARIABLE_NAME); if (context != null && context instanceof IContext) { final VariablesMap<?,?> variablesMap = ((IContext)context).getVariables(); variablesMap.setRestrictions(restrictions); } if (evaluationRoot != null && evaluationRoot instanceof VariablesMap<?,?>) { ((VariablesMap<?,?>)evaluationRoot).setRestrictions(restrictions); } }
public Object getSelectionTarget() { if (hasLocalVariable(EVAL_SELECTION_TARGET_LOCAL_VARIABLE_NAME)) { return getLocalVariable(EVAL_SELECTION_TARGET_LOCAL_VARIABLE_NAME); } if (getContext().getVariables().containsKey(EVAL_SELECTION_TARGET_LOCAL_VARIABLE_NAME)) { return getContext().getVariables().get(EVAL_SELECTION_TARGET_LOCAL_VARIABLE_NAME); } return null; }
public boolean hasSelectionTarget() { return hasLocalVariable(EVAL_SELECTION_TARGET_LOCAL_VARIABLE_NAME) || getContext().getVariables().containsKey(EVAL_SELECTION_TARGET_LOCAL_VARIABLE_NAME); }
final Template mayBeParentTemplate = (Template) templateProcessingParameters.getContext().getVariables() .get("__TEMPLATE__");