← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10437: FRED-API: use extension in hrefs if extension is used in URL

 

------------------------------------------------------------
revno: 10437
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-03-29 19:34:41 +0700
message:
  FRED-API: use extension in hrefs if extension is used in URL
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-12 08:47:44 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityController.java	2013-03-29 12:34:41 +0000
@@ -334,6 +334,11 @@
             addHierarchyPropertyToFacility( organisationUnitLevels, facility );
 
             facilities.getFacilities().add( facility );
+
+            if ( request.getRequestURL().toString().endsWith( ".json" ) )
+            {
+                facility.setHref( facility.getHref() + ".json" );
+            }
         }
 
         setAccessRights( model );
@@ -377,6 +382,11 @@
         filterFacility( facility, allProperties, fields );
         addHierarchyPropertyToFacility( organisationUnitLevels, facility );
 
+        if ( request.getRequestURL().toString().endsWith( ".json" ) )
+        {
+            facility.setHref( facility.getHref() + ".json" );
+        }
+
         setAccessRights( model );
 
         model.addAttribute( "esc", StringEscapeUtils.class );