=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AnalyticsController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AnalyticsController.java 2013-03-04 10:30:59 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AnalyticsController.java 2013-03-07 10:31:15 +0000 @@ -100,23 +100,7 @@ Grid grid = analyticsService.getAggregatedDataValues( params ); GridUtils.toXml( grid, response.getOutputStream() ); } - - @RequestMapping( value = RESOURCE_PATH + ".csv", method = RequestMethod.GET ) - public void getCsv( - @RequestParam Set dimension, - @RequestParam(required = false) Set filter, - @RequestParam(required = false) AggregationType aggregationType, - @RequestParam(required = false) String measureCriteria, - Model model, - HttpServletResponse response ) throws Exception - { - DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, i18nManager.getI18nFormat() ); - contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_CSV, CacheStrategy.RESPECT_SYSTEM_SETTING ); - Grid grid = analyticsService.getAggregatedDataValues( params ); - GridUtils.toCsv( grid.substituteMetaData(), response.getOutputStream() ); - } - @RequestMapping( value = RESOURCE_PATH + ".html", method = RequestMethod.GET ) public void getHtml( @RequestParam Set dimension, @@ -133,6 +117,22 @@ GridUtils.toHtml( grid.substituteMetaData(), response.getWriter() ); } + @RequestMapping( value = RESOURCE_PATH + ".csv", method = RequestMethod.GET ) + public void getCsv( + @RequestParam Set dimension, + @RequestParam(required = false) Set filter, + @RequestParam(required = false) AggregationType aggregationType, + @RequestParam(required = false) String measureCriteria, + Model model, + HttpServletResponse response ) throws Exception + { + DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, i18nManager.getI18nFormat() ); + + contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_CSV, CacheStrategy.RESPECT_SYSTEM_SETTING, "data.csv", true ); + Grid grid = analyticsService.getAggregatedDataValues( params ); + GridUtils.toCsv( grid.substituteMetaData(), response.getOutputStream() ); + } + @RequestMapping( value = RESOURCE_PATH + ".xls", method = RequestMethod.GET ) public void getXls( @RequestParam Set dimension, @@ -144,7 +144,7 @@ { DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, i18nManager.getI18nFormat() ); - contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_EXCEL, CacheStrategy.RESPECT_SYSTEM_SETTING ); + contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_EXCEL, CacheStrategy.RESPECT_SYSTEM_SETTING, "data.xls", true ); Grid grid = analyticsService.getAggregatedDataValues( params ); GridUtils.toXls( grid.substituteMetaData(), response.getOutputStream() ); }