
net.javapla.jawn.core.TemplateRenderer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jawn-core Show documentation
Show all versions of jawn-core Show documentation
java-web-planet / jawn - A simple web framework in Java
The newest version!
package net.javapla.jawn.core;
import java.util.HashMap;
import java.util.Map;
public interface TemplateRenderer extends Renderer {
String ENV_TEMPLATE_PATH_KEY = "views.path";
String DEFAULT_TEMPLATE_PATH = "views";
//String DEFAULT_TEMPLATE_DIR
byte[] render(Context ctx, Template template) throws Exception;
@Override
default byte[] render(Context ctx, Object value) throws Exception {
ctx.resp().rendererContentType(MediaType.HTML);
return render(ctx, (Template) value);
}
public static class Template {
public final String viewName;
public final Map data;
public Template(String view, Map data) {
this.viewName = view;
this.data = data;
}
public Template(String view) {
this(view, new HashMap<>());
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy