List of usage examples for org.springframework.web.context WebApplicationContext getApplicationName
String getApplicationName();
From source file:com.nec.harvest.servlet.listener.WebApplicationContextLoaderListener.java
/** * Initialize the root web application context *//* www . java 2s . c o m*/ @Override public void contextInitialized(ServletContextEvent event) { super.contextInitialized(event); // Starting Harvest environment initialization... if (logger.isDebugEnabled()) { logger.debug("Starting Harvest environment initialization..."); } /// You can get Servlet Context ServletContext servletContext = event.getServletContext(); WebApplicationContext webApplicationContext = WebApplicationContextUtils .getRequiredWebApplicationContext(servletContext); String jasperReportPath = getReportPath(webApplicationContext); // Create new a folder to store all of reports logger.info("Trying to create a new local storage {} folder for all reports", jasperReportPath); File folder = new File(jasperReportPath); if (!folder.exists()) { folder.mkdirs(); } // ???? logger.info("Successfully created a report storage folder to store all of temporary reports"); // logger.info("Context instance: {}", webApplicationContext); logger.info("Application name: {} && path: {}", webApplicationContext.getApplicationName(), servletContext.getContextPath()); }