← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18029: App controller, fixed bug. Using context path instead of server url as dhis href when installing ...

 

------------------------------------------------------------
revno: 18029
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-01-16 18:12:53 +0100
message:
  App controller, fixed bug. Using context path instead of server url as dhis href when installing apps.
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AppController.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-api/src/main/java/org/hisp/dhis/webapi/controller/AppController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AppController.java	2015-01-16 16:44:06 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AppController.java	2015-01-16 17:12:53 +0000
@@ -94,8 +94,10 @@
     {
         File tempFile = File.createTempFile( "IMPORT_", "_ZIP" );
         file.transferTo( tempFile );
-
-        appManager.installApp( tempFile, file.getOriginalFilename(), getBaseUrl( request ) );
+        
+        String contextPath = ContextUtils.getContextPath( request );
+        
+        appManager.installApp( tempFile, file.getOriginalFilename(), contextPath );
     }
 
     @RequestMapping( method = RequestMethod.PUT )
@@ -136,7 +138,9 @@
         {
             if ( "*".equals( application.getActivities().getDhis().getHref() ) )
             {
-                application.getActivities().getDhis().setHref( getBaseUrl( request ) );
+                String contextPath = ContextUtils.getContextPath( request );
+                
+                application.getActivities().getDhis().setHref( contextPath );
                 JacksonUtils.getJsonMapper().writeValue( response.getOutputStream(), application );
                 return;
             }
@@ -213,10 +217,4 @@
 
         return path;
     }
-
-    private String getBaseUrl( HttpServletRequest request )
-    {
-        String baseUrl = ContextUtils.getBaseUrl( request );
-        return baseUrl.substring( 0, baseUrl.length() - 1 );
-    }
 }