← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1181: Finally fixed

 

------------------------------------------------------------
revno: 1181
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Tue 2009-12-08 21:36:33 +0100
message:
  Finally fixed
modified:
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/ChartResult.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/ChartResult.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/ChartResult.java	2009-12-08 20:23:35 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/ChartResult.java	2009-12-08 20:36:33 +0000
@@ -35,7 +35,7 @@
 public class ChartResult
     implements Result
 {
-    private static final String DEFAULT_CONTENT_TYPE = "image/png";
+    private static final String CONTENT_TYPE = "image/png";
     
     private JFreeChart chart = null;
 
@@ -43,8 +43,6 @@
 
     private Integer width;
     
-    private String contentType;
-
     /**
      * Sets the JFreeChart to use.
      * 
@@ -76,16 +74,6 @@
     }
     
     /**
-     * Sets the content type.
-     * 
-     * @param contentType the content type.
-     */
-    public void setContentType( String contentType )
-    {
-        this.contentType = contentType;
-    }
-
-    /**
      * Executes the result. Writes the given chart as a PNG to the servlet
      * output stream.
      * 
@@ -108,10 +96,6 @@
         
         width = stackWidth != null && stackWidth > 0 ? stackWidth : width;
         
-        String stackContentType = invocation.getStack().findString( "contentType" );
-        
-        contentType = stackContentType != null && !stackContentType.trim().isEmpty() ? stackContentType : contentType;
-        
         if ( chart == null )
         {
             throw new NullPointerException( "No chart found" );
@@ -127,13 +111,8 @@
             throw new IllegalArgumentException( "Width not set" );
         }
         
-        if ( contentType == null )
-        {
-            contentType = DEFAULT_CONTENT_TYPE;
-        }
-        
         HttpServletResponse response = ServletActionContext.getResponse();
-        response.setContentType( contentType );
+        response.setContentType( CONTENT_TYPE );
         OutputStream os = response.getOutputStream();
         ChartUtilities.writeChartAsPNG( os, chart, width, height );
         os.flush();