/** * Executes the operation. * @param definitionName The name of the definition to render. * @param template If specified, this template will be used instead of the * one used by the definition. * @param templateType The type of the template attribute. * @param templateExpression The expression to evaluate to get the value of the template. * @param role A comma-separated list of roles. If present, the definition * will be rendered only if the current user belongs to one of the roles. * @param preparer The preparer to use to invoke before the definition is * rendered. If specified, it overrides the preparer specified in the * definition itself. * @param flush If <code>true</code>, the response will be flushed after the insert. * @param request The request. * @param modelBody The body. * @throws IOException If something goes wrong. * @since 2.2.0 */ public void execute( @Parameter(name = "name", required = true) String definitionName, String template, String templateType, String templateExpression, String role, String preparer, boolean flush, Request request, ModelBody modelBody) throws IOException { TilesContainer container = TilesAccess.getCurrentContainer(request); container.startContext(request); modelBody.evaluateWithoutWriting(); container = TilesAccess.getCurrentContainer(request); renderDefinition(container, definitionName, template, templateType, templateExpression, role, preparer, flush, request); }
/** {@inheritDoc} */ @Override public void doTag() throws JspException, IOException { AutotagRuntime<org.apache.tiles.request.Request> runtime = new org.apache.tiles.request.jsp.autotag.JspAutotagRuntime(); if (runtime instanceof SimpleTagSupport) { SimpleTagSupport tag = (SimpleTagSupport) runtime; tag.setJspContext(getJspContext()); tag.setJspBody(getJspBody()); tag.setParent(getParent()); tag.doTag(); } org.apache.tiles.request.Request request = runtime.createRequest(); ModelBody modelBody = runtime.createModelBody(); model.execute( definitionName, template, templateType, templateExpression, role, preparer, flush, request, modelBody ); } }
/** * Constructor. */ public TilesFMModelRepository() { insertDefinition = new InsertDefinitionFMModel(new org.apache.tiles.template.InsertDefinitionModel()); importAttribute = new ImportAttributeFMModel(new org.apache.tiles.template.ImportAttributeModel()); setCurrentContainer = new SetCurrentContainerFMModel(new org.apache.tiles.template.SetCurrentContainerModel()); addListAttribute = new AddListAttributeFMModel(new org.apache.tiles.template.AddListAttributeModel()); getAsString = new GetAsStringFMModel(new org.apache.tiles.template.GetAsStringModel()); insertAttribute = new InsertAttributeFMModel(new org.apache.tiles.template.InsertAttributeModel()); putAttribute = new PutAttributeFMModel(new org.apache.tiles.template.PutAttributeModel()); definition = new DefinitionFMModel(new org.apache.tiles.template.DefinitionModel()); addAttribute = new AddAttributeFMModel(new org.apache.tiles.template.AddAttributeModel()); putListAttribute = new PutListAttributeFMModel(new org.apache.tiles.template.PutListAttributeModel()); insertTemplate = new InsertTemplateFMModel(new org.apache.tiles.template.InsertTemplateModel()); }
/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public void execute(Environment env, @SuppressWarnings("rawtypes") Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException { AutotagRuntime<org.apache.tiles.request.Request> runtime = new org.apache.tiles.request.freemarker.autotag.FreemarkerAutotagRuntime(); if (runtime instanceof TemplateDirectiveModel) { ((TemplateDirectiveModel) runtime).execute(env, params, loopVars, body); } org.apache.tiles.request.Request request = runtime.createRequest(); ModelBody modelBody = runtime.createModelBody(); model.execute( runtime.getParameter("name", java.lang.String.class, null), runtime.getParameter("template", java.lang.String.class, null), runtime.getParameter("templateType", java.lang.String.class, null), runtime.getParameter("templateExpression", java.lang.String.class, null), runtime.getParameter("role", java.lang.String.class, null), runtime.getParameter("preparer", java.lang.String.class, null), runtime.getParameter("flush", java.lang.Boolean.class, false), request, modelBody ); } }
/** {@inheritDoc} */ @Override public boolean render(InternalContextAdapter context, Writer writer, Node node) throws IOException { AutotagRuntime<org.apache.tiles.request.Request> runtime = new org.apache.tiles.request.velocity.autotag.VelocityAutotagRuntime(); if (runtime instanceof Directive) { ((Directive) runtime).render(context, writer, node); } org.apache.tiles.request.Request request = runtime.createRequest(); ModelBody modelBody = runtime.createModelBody(); model.execute( runtime.getParameter("name", java.lang.String.class, null), runtime.getParameter("template", java.lang.String.class, null), runtime.getParameter("templateType", java.lang.String.class, null), runtime.getParameter("templateExpression", java.lang.String.class, null), runtime.getParameter("role", java.lang.String.class, null), runtime.getParameter("preparer", java.lang.String.class, null), runtime.getParameter("flush", java.lang.Boolean.class, false), request, modelBody ); return true; } }