Search in sources :

Example 1 with TemplateContext

use of core.framework.impl.template.TemplateContext in project core-ng-project by neowu.

the class TemplateManager method process.

public String process(String templatePath, Object model, String language) {
    StopWatch watch = new StopWatch();
    try {
        HTMLTemplate template = get(templatePath, model.getClass(), language);
        TemplateContext context = new TemplateContext(model, cdnManager);
        return template.process(context);
    } finally {
        logger.debug("process, templatePath={}, elapsedTime={}", templatePath, watch.elapsedTime());
    }
}
Also used : HTMLTemplate(core.framework.impl.template.HTMLTemplate) TemplateContext(core.framework.impl.template.TemplateContext) StopWatch(core.framework.util.StopWatch)

Example 2 with TemplateContext

use of core.framework.impl.template.TemplateContext in project core-ng-project by neowu.

the class HTMLTemplateEngine method process.

public String process(String name, Object model) {
    StopWatch watch = new StopWatch();
    try {
        HTMLTemplate template = templates.get(name);
        if (template == null)
            throw Exceptions.error("template not found, name={}", name);
        TemplateContext context = new TemplateContext(model, cdnManager);
        return template.process(context);
    } finally {
        logger.debug("process, name={}, elapsedTime={}", name, watch.elapsedTime());
    }
}
Also used : HTMLTemplate(core.framework.impl.template.HTMLTemplate) TemplateContext(core.framework.impl.template.TemplateContext) StopWatch(core.framework.util.StopWatch)

Aggregations

HTMLTemplate (core.framework.impl.template.HTMLTemplate)2 TemplateContext (core.framework.impl.template.TemplateContext)2 StopWatch (core.framework.util.StopWatch)2