← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12621: Added context info at /api/system/context

 

------------------------------------------------------------
revno: 12621
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-10-14 09:47:21 +0200
message:
  Added context info at /api/system/context
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/system/SystemInfo.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/SystemController.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-services/dhis-service-core/src/main/java/org/hisp/dhis/system/SystemInfo.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/system/SystemInfo.java	2013-09-04 13:52:48 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/system/SystemInfo.java	2013-10-14 07:47:21 +0000
@@ -99,7 +99,7 @@
         this.databaseInfo = null;
         this.memoryInfo = null;
         this.cpuCores = null;
-        this.systemId = systemId;
+        this.systemId = null;
     }
     
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/SystemController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/SystemController.java	2013-10-10 17:17:33 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/SystemController.java	2013-10-14 07:47:21 +0000
@@ -161,6 +161,17 @@
         JacksonUtils.toJson( response.getOutputStream(), info );
     }
     
+    @RequestMapping( value = "/context", method = RequestMethod.GET, produces = { "*/*", "application/json" } )
+    public void getContextInfo( HttpServletRequest request, HttpServletResponse response ) throws IOException
+    {
+        SystemInfo info = new SystemInfo();
+
+        info.setContextPath( ContextUtils.getContextPath( request ) );
+        info.setUserAgent( request.getHeader( ContextUtils.HEADER_USER_AGENT ) );
+
+        JacksonUtils.toJson( response.getOutputStream(), info );        
+    }
+    
     @RequestMapping( value = "/ping", method = RequestMethod.GET, produces = "text/plain" )
     public @ResponseBody String ping( Model model )
     {