public RapidoidTemplate loadAndCompile(String filename) { return new RapidoidTemplate(filename, loadTemplate(filename), this); }
@Override public void renderTo(Writable output, Object model) { doRender(Msc.locals(), output, model); }
public void renderMultiModel(OutputStream output, Object... model) { doRenderMulti(Msc.locals(), new WritableOutputStream(output), U.list(model)); }
public String model(Object model) { ByteArrayOutputStream out = new ByteArrayOutputStream(); template.renderTo(out, model); return new String(out.toByteArray()); }
void doRenderMulti(RapidoidThreadLocals locals, Writable output, List<Object> model) { // start using the render context RenderCtxImpl renderCtx = getRenderCtx(locals); renderCtx.out(output).factory(factory).filename(filename).multiModel(model); template.render(renderCtx); // stop using the render context renderCtx.reset(); }
public String multiModel(Object... model) { ByteArrayOutputStream out = new ByteArrayOutputStream(); template.renderMultiModel(out, model); return new String(out.toByteArray()); }
@Override public void call(String name) { RapidoidTemplate template = (RapidoidTemplate) factory.load(name + ext, Object.class); template.renderInContext(this); }
@Override public String render(Object model) { return new String(renderToBytes(model)); }
@Override public void renderTo(OutputStream output, Object model) { renderTo(new WritableOutputStream(output), model); }
void doRender(RapidoidThreadLocals locals, Writable output, Object model) { // start using the render context RenderCtxImpl renderCtx = getRenderCtx(locals); renderCtx.out(output).factory(factory).filename(filename).model(model); template.render(renderCtx); // stop using the render context renderCtx.reset(); }
public String multiModel(Object... model) { ByteArrayOutputStream out = new ByteArrayOutputStream(); template.renderMultiModel(out, model); return new String(out.toByteArray()); }
@Override public void call(String name) { RapidoidTemplate template = (RapidoidTemplate) factory.load(name + ext, Object.class); template.renderInContext(this); }
@Override public String render(Object model) { return new String(renderToBytes(model)); }
public String model(Object model) { ByteArrayOutputStream out = new ByteArrayOutputStream(); template.renderTo(out, model); return new String(out.toByteArray()); }
@Override public byte[] renderToBytes(Object model) { RapidoidThreadLocals locals = Msc.locals(); ReusableWritable out = locals.templateRenderingOutput(); doRender(locals, out, model); return out.copy(); }
void doRender(RapidoidThreadLocals locals, Writable output, Object model) { // start using the render context RenderCtxImpl renderCtx = getRenderCtx(locals); renderCtx.out(output).factory(factory).filename(filename).model(model); template.render(renderCtx); // stop using the render context renderCtx.reset(); }
@Override public Template compile(String source, Class<?> modelType) { return new RapidoidTemplate(null, TemplateParser.parse(source).compile(modelType), this); }
public void renderMultiModel(OutputStream output, Object... model) { doRenderMulti(Msc.locals(), new WritableOutputStream(output), U.list(model)); }
@Override public void renderTo(OutputStream output, Object model) { renderTo(new WritableOutputStream(output), model); }
@Override public void renderTo(Writable output, Object model) { doRender(Msc.locals(), output, model); }