dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #33051
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16825: Apps, proper setting of href/link to dhis through upload
------------------------------------------------------------
revno: 16825
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-09-26 08:26:22 +0200
message:
Apps, proper setting of href/link to dhis through upload
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/appmanager/DefaultAppManager.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-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-services/dhis-service-core/src/main/java/org/hisp/dhis/appmanager/DefaultAppManager.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/appmanager/DefaultAppManager.java 2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/appmanager/DefaultAppManager.java 2014-09-26 06:26:22 +0000
@@ -99,9 +99,12 @@
InputStream inputStream = zip.getInputStream( entry );
ObjectMapper mapper = new ObjectMapper();
mapper.configure( DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false );
+
App app = mapper.readValue( inputStream, App.class );
+ // ---------------------------------------------------------------------
// Delete if app is already installed
+ // ---------------------------------------------------------------------
if ( getApps().contains( app ) )
{
@@ -115,7 +118,9 @@
unzip.setDest( new File( dest ) );
unzip.execute();
- // Updating dhis server location
+ // ---------------------------------------------------------------------
+ // Set dhis server location
+ // ---------------------------------------------------------------------
File updateManifest = new File( dest + File.separator + "manifest.webapp" );
App installedApp = mapper.readValue( updateManifest, App.class );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AddAppAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AddAppAction.java 2014-09-26 06:00:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AddAppAction.java 2014-09-26 06:26:22 +0000
@@ -106,6 +106,8 @@
public String execute()
throws Exception
{
+ HttpServletRequest request = ServletActionContext.getRequest();
+
if ( file == null )
{
message = i18n.getString( "appmanager_no_file_specified" );
@@ -134,7 +136,9 @@
try
{
- appManager.installApp( file, fileName, getRootPath() );
+ String contextPath = ContextUtils.getContextPath( request );
+
+ appManager.installApp( file, fileName, contextPath );
message = i18n.getString( "appmanager_install_success" );
@@ -154,14 +158,4 @@
}
}
}
-
- 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;
- }
}