← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2523: Minor fix

 

------------------------------------------------------------
revno: 2523
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-01-11 16:07:13 +0100
message:
  Minor fix
modified:
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridCsvResult.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridPdfResult.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridXlsResult.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/util/ContextUtils.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/util/StreamActionSupport.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-commons/src/main/java/org/hisp/dhis/result/GridCsvResult.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridCsvResult.java	2011-01-10 17:52:52 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridCsvResult.java	2011-01-11 15:07:13 +0000
@@ -89,7 +89,7 @@
 
         String filename = CodecUtils.filenameEncode( StringUtils.defaultIfEmpty( grid.getTitle(), DEFAULT_FILENAME ) ) + ".csv";
         
-        ContextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_CSV, true, filename );
+        ContextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_CSV, true, filename, false );
 
         // ---------------------------------------------------------------------
         // Write CSV to output stream

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridPdfResult.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridPdfResult.java	2010-12-26 23:25:10 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridPdfResult.java	2011-01-11 15:07:13 +0000
@@ -90,7 +90,7 @@
 
         String filename = CodecUtils.filenameEncode( StringUtils.defaultIfEmpty( grid.getTitle(), DEFAULT_FILENAME ) ) + ".pdf";
         
-        ContextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_PDF, true, filename );
+        ContextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_PDF, true, filename, false );
 
         // ---------------------------------------------------------------------
         // Write PDF to output stream

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridXlsResult.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridXlsResult.java	2010-12-26 15:38:45 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridXlsResult.java	2011-01-11 15:07:13 +0000
@@ -106,7 +106,7 @@
 
         String filename = CodecUtils.filenameEncode( StringUtils.defaultIfEmpty( grid.getTitle(), DEFAULT_FILENAME ) ) + ".xls";
                 
-        ContextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_EXCEL, true, filename );
+        ContextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_EXCEL, true, filename, false );
         
         // ---------------------------------------------------------------------
         // Create workbook and write to output stream

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/util/ContextUtils.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/util/ContextUtils.java	2011-01-10 17:52:52 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/util/ContextUtils.java	2011-01-11 15:07:13 +0000
@@ -83,7 +83,7 @@
         return baseUrl;
     }
     
-    public static void configureResponse( HttpServletResponse response, String contentType, boolean disallowCache, String filename )
+    public static void configureResponse( HttpServletResponse response, String contentType, boolean disallowCache, String filename, boolean attachment )
     {
         if ( contentType != null )
         {
@@ -98,7 +98,9 @@
 
         if ( filename != null )
         {
-            response.addHeader( "Content-Disposition", "inline; filename=\"" + filename + "\"" );
+            String type = attachment ? "attachment" : "inline";
+            
+            response.addHeader( "Content-Disposition", type + "; filename=\"" + filename + "\"" );
         }
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/util/StreamActionSupport.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/util/StreamActionSupport.java	2010-12-26 15:38:45 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/util/StreamActionSupport.java	2011-01-11 15:07:13 +0000
@@ -54,7 +54,7 @@
         
         HttpServletResponse response = ServletActionContext.getResponse();
         
-        ContextUtils.configureResponse( response, getContentType(), disallowCache(), getFilename() );
+        ContextUtils.configureResponse( response, getContentType(), disallowCache(), getFilename(), true );
         
         try
         {