dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17792
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7218: added content-disposition to metaData.xml/.json export
------------------------------------------------------------
revno: 7218
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-06-06 14:57:47 +0200
message:
added content-disposition to metaData.xml/.json export
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MetaDataController.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/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<String, String> 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<String, String> 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<String, String> parameters, HttpServletResponse response ) throws IOException