Java Code Examples for org.beetl.core.GroupTemplate#registerFunctionPackage()
The following examples show how to use
org.beetl.core.GroupTemplate#registerFunctionPackage() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BeetlFrameworkConfig.java From feiqu-opensource with Apache License 2.0 | 6 votes |
@Bean public BeetlTemplateCustomize beetlTemplateCustomize(@Qualifier("beetl_functions") Functions fn) { return new BeetlTemplateCustomize() { @Override public void customize(GroupTemplate groupTemplate) { groupTemplate.registerFunctionPackage("c", fn); Map vars = new HashMap<String, Object>() {{ put("VERSION", Global.getConfig("feiqu.cssVersion")); put("LAYUI_VERSION", Global.getConfig("feiqu.layuiVersion")); put("DOMAIN_URL", Global.getConfig("feiqu.domainUrl")); }}; groupTemplate.setSharedVars(vars); } }; }
Example 2
Source File: BaseSimulate.java From beetl2.0 with BSD 3-Clause "New" or "Revised" License | 5 votes |
public BaseSimulate(GroupTemplate gt,JsonUtil jsonUtil,String base){ this.gt = gt; this.base = base; this.jsonUtil = jsonUtil; if(jsonUtil!=null){ gt.registerFunctionPackage("jsonUtil", jsonUtil); gt.registerFunction("jsonBody", new ReuqestBodyFunction(jsonUtil) ); } }
Example 3
Source File: RegisterFunctionByFile.java From beetl2.0 with BSD 3-Clause "New" or "Revised" License | 5 votes |
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); }
Example 4
Source File: ShiroExt.java From MeetingFilm with Apache License 2.0 | 4 votes |
public static void main(String[] args) { GroupTemplate gt = new GroupTemplate(); gt.registerFunctionPackage("shiro", new ShiroExt()); }