← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12261: Apps, using java.util instead of apache.tools for zip

 

------------------------------------------------------------
revno: 12261
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-09-26 18:21:22 +0200
message:
  Apps, using java.util instead of apache.tools for zip
modified:
  dhis-2/dhis-web/dhis-web-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AddAppAction.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-2/dhis-web/dhis-web-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AddAppAction.java'
--- dhis-2/dhis-web/dhis-web-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AddAppAction.java	2013-09-26 15:37:32 +0000
+++ dhis-2/dhis-web/dhis-web-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AddAppAction.java	2013-09-26 16:21:22 +0000
@@ -40,8 +40,8 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.struts2.ServletActionContext;
-import org.apache.tools.zip.ZipEntry;
-import org.apache.tools.zip.ZipFile;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
 import org.hisp.dhis.appmanager.App;
 import org.hisp.dhis.appmanager.AppManagerService;
 import org.hisp.dhis.i18n.I18n;
@@ -172,11 +172,7 @@
             if ( installedApp.getActivities().getDhis().getHref().equals( "*" ) )
             {
                 // TODO: Check why ContextUtils.getContextPath is not working
-                // String rootPath = ContextUtils.getContextPath(ServletActionContext.getRequest());
-                HttpServletRequest req = ServletActionContext.getRequest();
-                StringBuffer fullUrl = req.getRequestURL();
-                String baseUrl = ContextUtils.getBaseUrl( req );
-                String rootPath = fullUrl.substring( 0, fullUrl.indexOf( "/", baseUrl.length() ) );
+                String rootPath = getRootPath();
 
                 installedApp.getActivities().getDhis().setHref( rootPath );
                 mapper.writeValue( updateManifest, installedApp );
@@ -198,4 +194,14 @@
 
         return SUCCESS;
     }
+    
+    private String getRootPath()
+    {
+        HttpServletRequest req = ServletActionContext.getRequest();
+        StringBuffer fullUrl = req.getRequestURL();
+        String baseUrl = ContextUtils.getBaseUrl( req );
+        String rootPath = fullUrl.substring( 0, fullUrl.indexOf( "/", baseUrl.length() ) );
+        
+        return rootPath;
+    }
 }