| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package edu.sampleu.travel.infrastructure; |
| 17 | |
|
| 18 | |
import java.io.FileNotFoundException; |
| 19 | |
|
| 20 | |
import javax.servlet.ServletContextEvent; |
| 21 | |
import javax.servlet.ServletContextListener; |
| 22 | |
|
| 23 | |
import org.apache.log4j.Logger; |
| 24 | |
import org.kuali.rice.core.web.jetty.JettyServer; |
| 25 | |
import org.springframework.util.Log4jConfigurer; |
| 26 | |
|
| 27 | |
import uk.ltd.getahead.dwr.util.LoggingOutput; |
| 28 | |
|
| 29 | |
|
| 30 | |
|
| 31 | |
|
| 32 | |
|
| 33 | |
|
| 34 | |
|
| 35 | |
|
| 36 | 0 | public class TravelAppInitializeListener implements ServletContextListener { |
| 37 | 0 | private static final Logger LOG = Logger.getLogger(TravelAppInitializeListener.class); |
| 38 | |
|
| 39 | |
public void contextDestroyed(ServletContextEvent sce) { |
| 40 | |
|
| 41 | 0 | } |
| 42 | |
|
| 43 | |
public void contextInitialized(ServletContextEvent sce) { |
| 44 | |
try { |
| 45 | 0 | Log4jConfigurer.initLogging("classpath:log4j.properties"); |
| 46 | 0 | } catch (FileNotFoundException e) { |
| 47 | 0 | throw new RuntimeException("Failed to start sample application.", e); |
| 48 | 0 | } |
| 49 | |
|
| 50 | 0 | Object o = sce.getServletContext().getAttribute(JettyServer.JETTYSERVER_TESTMODE_ATTRIB); |
| 51 | 0 | boolean testMode = false; |
| 52 | 0 | if (o != null) { |
| 53 | 0 | testMode = Boolean.valueOf((String) o); |
| 54 | |
} |
| 55 | 0 | LOG.info("Travel webapp starting up in " + (testMode ? "test" : "normal") + " mode"); |
| 56 | |
|
| 57 | 0 | TravelServiceLocator.initialize(testMode); |
| 58 | 0 | } |
| 59 | |
} |