=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MetaDataController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MetaDataController.java 2012-06-06 11:36:25 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MetaDataController.java 2012-06-06 12:57:47 +0000 @@ -84,6 +84,30 @@ return "export"; } + @RequestMapping( value = MetaDataController.RESOURCE_PATH + ".xml", method = RequestMethod.GET, produces = { "application/xml", "text/*" } ) + @PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_EXPORT')" ) + public void exportXml( @RequestParam Map parameters, HttpServletResponse response ) throws IOException + { + WebOptions options = new WebOptions( parameters ); + MetaData metaData = exportService.getMetaData( options ); + + contextUtils.configureResponse( response, CONTENT_TYPE_XML, CacheStrategy.NO_CACHE, "metaData.xml", true ); + + JacksonUtils.toXmlWithView( response.getOutputStream(), metaData, ExportView.class ); + } + + @RequestMapping( value = MetaDataController.RESOURCE_PATH + ".json", method = RequestMethod.GET, produces = { "application/json" } ) + @PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_EXPORT')" ) + public void exportJson( @RequestParam Map parameters, HttpServletResponse response ) throws IOException + { + WebOptions options = new WebOptions( parameters ); + MetaData metaData = exportService.getMetaData( options ); + + contextUtils.configureResponse( response, CONTENT_TYPE_JSON, CacheStrategy.NO_CACHE, "metaData.json", true ); + + JacksonUtils.toXmlWithView( response.getOutputStream(), metaData, ExportView.class ); + } + @RequestMapping( value = { MetaDataController.RESOURCE_PATH + ".zip", MetaDataController.RESOURCE_PATH + ".xml.zip" }, method = RequestMethod.GET, produces = { "application/xml", "text/*" } ) @PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_EXPORT')" ) public void exportZippedXML( @RequestParam Map parameters, HttpServletResponse response ) throws IOException