← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9981: FRED-API: change to using If-Match header for conditional puts

 

------------------------------------------------------------
revno: 9981
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-03-05 12:09:02 +0300
message:
  FRED-API: change to using If-Match header for conditional puts
modified:
  dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityController.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-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityController.java'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityController.java	2013-03-04 12:07:19 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityController.java	2013-03-05 09:09:02 +0000
@@ -559,7 +559,7 @@
             OrganisationUnit organisationUnitUpdate = conversionService.convert( facility, OrganisationUnit.class );
             OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitUpdate.getUid() );
 
-            if ( request.getHeader( "ETag" ) != null )
+            if ( request.getHeader( "If-Match" ) != null )
             {
                 Facility old_facility = conversionService.convert( organisationUnit, Facility.class );
                 List<OrganisationUnitLevel> organisationUnitLevels = organisationUnitService.getOrganisationUnitLevels();
@@ -568,7 +568,7 @@
 
                 String ETag = generateETagHeaderValue( body.getBytes() );
 
-                if ( !ETag.equals( request.getHeader( "ETag" ) ) )
+                if ( !ETag.equals( request.getHeader( "If-Match" ) ) )
                 {
                     return new ResponseEntity<String>( MessageResponseUtils.jsonMessage( "ETag provided does not match current ETag of facility" ),
                         headers, HttpStatus.PRECONDITION_FAILED );