dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17943
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7352: make sure that accept header is present
------------------------------------------------------------
revno: 7352
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-06-22 19:25:04 +0300
message:
make sure that accept header is present
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-22 15:49:20 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MetaDataController.java 2012-06-22 16:25:04 +0000
@@ -111,7 +111,9 @@
@PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_EXPORT')" )
public void exportZipped( @RequestParam Map<String, String> parameters, HttpServletResponse response, HttpServletRequest request ) throws IOException
{
- if ( request.getHeader( "Accept" ).equalsIgnoreCase( "application/json" ) )
+ String accept = request.getHeader( "Accept" );
+
+ if ( accept != null && accept.equalsIgnoreCase( "application/json" ) )
{
exportZippedJSON( parameters, response );
}
@@ -157,7 +159,9 @@
@PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_EXPORT')" )
public void exportGZipped( @RequestParam Map<String, String> parameters, HttpServletResponse response, HttpServletRequest request ) throws IOException
{
- if ( request.getHeader( "Accept" ).equalsIgnoreCase( "application/json" ) )
+ String accept = request.getHeader( "Accept" );
+
+ if ( accept != null && accept.equalsIgnoreCase( "application/json" ) )
{
exportGZippedJSON( parameters, response );
}