use of com.fizzed.rocker.BindableRockerModel in project vertx-web by vert-x3.
the class RockerTemplateEngineImpl method render.
@Override
public void render(RoutingContext context, String templateDirectory, String templateFileName, Handler<AsyncResult<Buffer>> handler) {
try {
templateFileName = templateDirectory + templateFileName;
String templatePath = adjustLocation(templateFileName);
BindableRockerModel model = Rocker.template(templatePath);
model.bind("context", context);
model.bind(context.data());
VertxBufferOutput output = model.render(VertxBufferOutput.FACTORY);
handler.handle(Future.succeededFuture(output.getBuffer()));
} catch (final Exception ex) {
handler.handle(Future.failedFuture(ex));
}
}
use of com.fizzed.rocker.BindableRockerModel in project micronaut-views by micronaut-projects.
the class RockerViewsRenderer method render.
@NonNull
@Override
public Writable render(@NonNull String view, @Nullable T data, @Nullable HttpRequest<?> request) {
ArgumentUtils.requireNonNull("view", view);
Map<String, Object> context = ViewUtils.modelOf(data);
BindableRockerModel model = rockerConfiguration.isRelaxed() ? rockerEngine.template(view).relaxedBind(context) : rockerEngine.template(view).bind(context);
return new RockerWritable(model);
}
Aggregations