use of org.beetl.core.resource.FileResourceLoader in project beetl2.0 by javamonkey.
the class MetaCopyTest method main.
public static void main(String[] args) throws Exception {
String home = System.getProperty("user.dir") + File.separator + "template" + File.separator;
Configuration cf = Configuration.defaultConfiguration();
FileResourceLoader rs = new FileResourceLoader(home, cf.getCharset());
GroupTemplate gt = new GroupTemplate(rs, cf);
Template t = gt.getTemplate("/helloworld.html");
Program p = gt.getProgram("/helloworld.html");
ProgramMetaData old = p.metaData;
ProgramMetaData copy = old.copy();
System.out.println("ok");
}
use of org.beetl.core.resource.FileResourceLoader in project beetl2.0 by javamonkey.
the class FilePathRL method main.
public static void main(String[] args) throws Exception {
String root = System.getProperty("user.dir") + File.separator + "template";
FileResourceLoader resourceLoader = new FileResourceLoader(root, "utf-8");
Configuration cfg = Configuration.defaultConfiguration();
GroupTemplate gt = new GroupTemplate(resourceLoader, cfg);
Template t = gt.getTemplate("/s01/hello.txt");
String str = t.render();
System.out.println(str);
}
use of org.beetl.core.resource.FileResourceLoader in project beetl2.0 by javamonkey.
the class RegisterFunctionByFile method main.
public static void main(String[] args) throws Exception {
String root = System.getProperty("user.dir") + File.separator + "template";
FileResourceLoader resourceLoader = new FileResourceLoader(root, "utf-8");
Configuration cfg = Configuration.defaultConfiguration();
GroupTemplate gt = new GroupTemplate(resourceLoader, cfg);
gt.registerFunctionPackage("t", new FunctionPackage());
Template t = gt.getTemplate("/s32/functionPackage.html");
String str = t.render();
System.out.println(str);
}
use of org.beetl.core.resource.FileResourceLoader in project beetl2.0 by javamonkey.
the class RegisterFunctionPackage method main.
public static void main(String[] args) throws Exception {
String root = System.getProperty("user.dir") + File.separator + "template";
FileResourceLoader resourceLoader = new FileResourceLoader(root, "utf-8");
Configuration cfg = Configuration.defaultConfiguration();
GroupTemplate gt = new GroupTemplate(resourceLoader, cfg);
Template t = gt.getTemplate("/s32/pagefunction.html");
String str = t.render();
System.out.println(str);
}
use of org.beetl.core.resource.FileResourceLoader in project beetl2.0 by javamonkey.
the class IncludeJSPTag method getPrefix.
protected String getPrefix() {
ResourceLoader rs = ctx.gt.getResourceLoader();
String loaderRoot = null;
if (rs instanceof FileResourceLoader) {
loaderRoot = ((FileResourceLoader) rs).getRoot();
} else {
return "";
}
File loaderFileRoot = new File(loaderRoot);
if (loaderFileRoot.equals(root)) {
return "";
} else {
int len = root.getAbsolutePath().length();
return loaderFileRoot.getAbsolutePath().substring(len);
}
}
Aggregations