package com.aperture_software.glados_wiki.servlets; import org.apache.commons.lang3.ObjectUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; /** * Created by jhyun on 13. 12. 21. */ public class WebappPath implements ServletContextListener { private static Logger LOG = LoggerFactory.getLogger(WebappPath.class); private static String _webappPath = ""; public static String getWebappPath() { if (null == _webappPath) return ""; else return ObjectUtils.toString(_webappPath); } @Override public void contextInitialized(ServletContextEvent sce) { _webappPath = sce.getServletContext().getContextPath(); LOG.debug(String.format("WebappPAth = [%s]", _webappPath)); } @Override public void contextDestroyed(ServletContextEvent sce) { // } }