← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5454: Web api, minor fix

 

------------------------------------------------------------
revno: 5454
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-12-16 12:41:12 +0100
message:
  Web api, minor fix
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DocumentController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportController.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/api/controller/DocumentController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DocumentController.java	2011-12-16 10:26:08 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DocumentController.java	2011-12-16 11:41:12 +0000
@@ -112,12 +112,12 @@
             response.sendRedirect( response.encodeRedirectURL( document.getUrl() ) );
         }
         else
-        {
+        {            
+            ContextUtils.configureResponse( response, document.getContentType(), true, document.getUrl(), true );
+            
             InputStream in = locationManager.getInputStream( document.getUrl(), DocumentService.DIR );
 
             IOUtils.copy( in, response.getOutputStream() );
-            
-            ContextUtils.configureResponse( response, document.getContentType(), true, document.getUrl(), true );
         }
     }
 

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportController.java	2011-12-15 19:02:36 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportController.java	2011-12-16 11:41:12 +0000
@@ -148,10 +148,10 @@
 
         Date date = period != null ? DateUtils.getMediumDate( period ) : new Cal().now().subtract( Calendar.MONTH, 1 ).time();
 
+        String filename = CodecUtils.filenameEncode( report.getName() ) + "." + type;
+        ContextUtils.configureResponse( response, contentType, true, filename, attachment );
+        
         reportService.renderReport( response.getOutputStream(), uid, date, organisationUnitUid, type,
             i18nManager.getI18nFormat() );
-
-        String filename = CodecUtils.filenameEncode( report.getName() ) + "." + type;
-        ContextUtils.configureResponse( response, contentType, true, filename, attachment );
     }
 }