← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12622: Web api, enabling jsonp for system resource

 

------------------------------------------------------------
revno: 12622
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-10-14 09:57:24 +0200
message:
  Web api, enabling jsonp for system resource
modified:
  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-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-14 07:47:21 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/SystemController.java	2013-10-14 07:57:24 +0000
@@ -145,8 +145,8 @@
         JacksonUtils.toJson( response.getOutputStream(), importSummary );
     }
     
-    @RequestMapping( value = "/info", method = RequestMethod.GET, produces = { "*/*", "application/json" } )
-    public void getSystemInfo( HttpServletRequest request, HttpServletResponse response ) throws IOException
+    @RequestMapping( value = "/info", method = RequestMethod.GET, produces = { "application/json", "application/javascript" } )
+    public String getSystemInfo( Model model, HttpServletRequest request, HttpServletResponse response )
     {
         SystemInfo info = systemService.getSystemInfo();
         
@@ -157,19 +157,23 @@
         {
             info.clearSensitiveInfo();
         }
+
+        model.addAttribute( "model", info );
         
-        JacksonUtils.toJson( response.getOutputStream(), info );
+        return "info";
     }
     
-    @RequestMapping( value = "/context", method = RequestMethod.GET, produces = { "*/*", "application/json" } )
-    public void getContextInfo( HttpServletRequest request, HttpServletResponse response ) throws IOException
+    @RequestMapping( value = "/context", method = RequestMethod.GET, produces = { "application/json", "application/javascript" } )
+    public String getContextInfo( Model model, HttpServletRequest request, HttpServletResponse response )
     {
         SystemInfo info = new SystemInfo();
 
         info.setContextPath( ContextUtils.getContextPath( request ) );
         info.setUserAgent( request.getHeader( ContextUtils.HEADER_USER_AGENT ) );
 
-        JacksonUtils.toJson( response.getOutputStream(), info );        
+        model.addAttribute( "model", info );
+        
+        return "info";
     }
     
     @RequestMapping( value = "/ping", method = RequestMethod.GET, produces = "text/plain" )