← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12850: minor change

 

------------------------------------------------------------
revno: 12850
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-11-01 11:15:04 +0100
message:
  minor change
modified:
  dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityAdvice.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/FacilityAdvice.java'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityAdvice.java	2013-11-01 10:01:06 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityAdvice.java	2013-11-01 10:15:04 +0000
@@ -41,6 +41,7 @@
 import org.springframework.http.HttpStatus;
 import org.springframework.http.MediaType;
 import org.springframework.http.ResponseEntity;
+import org.springframework.web.HttpMediaTypeNotAcceptableException;
 import org.springframework.web.HttpMediaTypeNotSupportedException;
 import org.springframework.web.bind.annotation.ControllerAdvice;
 import org.springframework.web.bind.annotation.ExceptionHandler;
@@ -118,6 +119,15 @@
         headers.add( "Content-Type", MediaType.APPLICATION_JSON_VALUE );
 
         return new ResponseEntity<Object>( MessageUtils.jsonMessage(
-            "415", ex.getMessage() ), HttpStatus.UNSUPPORTED_MEDIA_TYPE );
+            Integer.toString( status.value() ), ex.getMessage() ), status );
+    }
+
+    @Override
+    protected ResponseEntity<Object> handleHttpMediaTypeNotAcceptable( HttpMediaTypeNotAcceptableException ex, HttpHeaders headers, HttpStatus status, WebRequest request )
+    {
+        headers.add( "Content-Type", MediaType.APPLICATION_JSON_VALUE );
+
+        return new ResponseEntity<Object>( MessageUtils.jsonMessage(
+            Integer.toString( status.value() ), ex.getMessage() ), status );
     }
 }