Init project
This commit is contained in:
29
src/main/java/kinosearch/webapp/WebApp.java
Normal file
29
src/main/java/kinosearch/webapp/WebApp.java
Normal file
@@ -0,0 +1,29 @@
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user