← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 796: Made the WebAppServer verify that the BIRT webapp is included before attempting to start it. BIRT...

 

------------------------------------------------------------
revno: 796
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Mon 2009-09-28 20:11:45 +0200
message:
  Made the WebAppServer verify that the BIRT webapp is included before attempting to start it. BIRT is optional now that Jasper is supported.
modified:
  dhis-live/src/main/java/org/hisp/dhis/WebAppServer.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription.
=== modified file 'dhis-live/src/main/java/org/hisp/dhis/WebAppServer.java'
--- dhis-live/src/main/java/org/hisp/dhis/WebAppServer.java	2009-09-28 17:18:13 +0000
+++ dhis-live/src/main/java/org/hisp/dhis/WebAppServer.java	2009-09-28 18:11:45 +0000
@@ -33,6 +33,8 @@
 
 package org.hisp.dhis;
 
+import java.io.File;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.mortbay.component.LifeCycle;
@@ -68,18 +70,20 @@
     connector.setPort(Integer.getInteger("jetty.port",8080).intValue());
     server.setConnectors(new Connector[]{connector});
 
+    ContextHandlerCollection handlers = new ContextHandlerCollection();
+    
     WebAppContext dhisWebApp = new WebAppContext();
     dhisWebApp.setWar(installDir + DHIS_DIR);
+    handlers.addHandler(dhisWebApp);
     log.info("Setting DHIS 2 web app context to: "+ installDir + DHIS_DIR);
     
-    WebAppContext birtWebApp = new WebAppContext();
-    birtWebApp.setContextPath(BIRT_CONTEXT_PATH);
-    birtWebApp.setWar(installDir + BIRT_DIR);
-    log.info("Setting BIRT web app context to: "+ installDir + BIRT_DIR);
-    
-    ContextHandlerCollection handlers = new ContextHandlerCollection();
-    handlers.addHandler(dhisWebApp);
-    handlers.addHandler(birtWebApp);    
+    if ( new File( installDir, BIRT_DIR ).exists() ) {
+      WebAppContext birtWebApp = new WebAppContext();
+      birtWebApp.setContextPath(BIRT_CONTEXT_PATH);
+      birtWebApp.setWar(installDir + BIRT_DIR);
+      handlers.addHandler(birtWebApp);  
+      log.info("Setting BIRT web app context to: "+ installDir + BIRT_DIR);
+    }
     
     server.setHandler(handlers);
     server.addLifeCycleListener(serverListener);


Follow ups