Package es.ua.dccia.web

Source Code of es.ua.dccia.web.MustacheInitializer

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package es.ua.dccia.web;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import org.trimou.engine.MustacheEngine;
import org.trimou.engine.MustacheEngineBuilder;
import org.trimou.engine.config.EngineConfigurationKey;
import org.trimou.servlet.locator.ServletContextTemplateLocator;

/**
*
* @author otto
*/
@WebListener
public class MustacheInitializer implements ServletContextListener {

    @Override
    public void contextInitialized(ServletContextEvent sce) {
        ServletContext sc = sce.getServletContext();
        MustacheEngine engine = MustacheEngineBuilder
                .newBuilder()
                .setProperty(EngineConfigurationKey.DEBUG_MODE, true)
                .setProperty(EngineConfigurationKey.DEFAULT_FILE_ENCODING, "UTF-8")
                .addTemplateLocator(new ServletContextTemplateLocator(1,"/","html"))
                .build();
        MustacheServlet.setMustacheEngine(engine);
    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {
    }
   
}
TOP

Related Classes of es.ua.dccia.web.MustacheInitializer

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.