@Override
public void contextInitialized(ServletContextEvent e) {
Play.standalonePlayServer = false;
ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
String appDir = e.getServletContext().getRealPath("/WEB-INF/application");
File root = new File(appDir);
String playId = System.getProperty("play.id", e.getServletContext().getInitParameter("play.id"));
if (StringUtils.isEmpty(playId)) {
throw new UnexpectedException("Please define a play.id parameter in your web.xml file. Without that parameter, play! cannot start your application. Please add a context-param into the WEB-INF/web.xml file.");
}
Play.frameworkPath = root.getParentFile();
Play.usePrecompiled = true;
Play.init(root, playId);
Play.Mode mode = Play.Mode.valueOf(Play.configuration.getProperty("application.mode", "DEV").toUpperCase());
if (mode.isDev()) {
Logger.info("Forcing PROD mode because deploying as a war file.");
}
if (isGreaterThan(e.getServletContext(), 2, 4)) {
loadRouter(e.getServletContext().getContextPath());
}
Thread.currentThread().setContextClassLoader(oldClassLoader);
}