30 lines
764 B
Java
30 lines
764 B
Java
package kinosearch.webapp;
|
|
|
|
import kinosearch.webapp.template.FreemakerProcessor;
|
|
import kinosearch.webapp.template.TemplateProcessor;
|
|
|
|
import javax.servlet.ServletContextEvent;
|
|
import javax.servlet.ServletContextListener;
|
|
|
|
public class WebApp implements ServletContextListener {
|
|
private static boolean _init = false;
|
|
private static TemplateProcessor templateProcessor;
|
|
|
|
public static TemplateProcessor getTemplateProcessor() {
|
|
return (_init ? templateProcessor : null);
|
|
}
|
|
|
|
@Override
|
|
public void contextInitialized(ServletContextEvent sce) {
|
|
templateProcessor = new FreemakerProcessor();
|
|
_init = true;
|
|
}
|
|
|
|
@Override
|
|
public void contextDestroyed(ServletContextEvent sce) {
|
|
_init = false;
|
|
}
|
|
|
|
|
|
}
|