dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #31223
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15897: put resources index back at /api/resources, made /api and /api/ redirect there.
------------------------------------------------------------
revno: 15897
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2014-06-28 12:52:57 +0700
message:
put resources index back at /api/resources, made /api and /api/ redirect there.
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/IndexController.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/webapi/controller/IndexController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/IndexController.java 2014-06-28 05:34:29 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/IndexController.java 2014-06-28 05:52:57 +0000
@@ -36,12 +36,17 @@
import org.hisp.dhis.schema.Schema;
import org.hisp.dhis.schema.SchemaService;
import org.hisp.dhis.webapi.service.ContextService;
+import org.hisp.dhis.webapi.utils.ContextUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
@@ -59,13 +64,21 @@
//--------------------------------------------------------------------------
@RequestMapping( value = "/api", method = RequestMethod.GET )
- public @ResponseBody RootNode getIndex()
+ public void getIndex( HttpServletRequest request, HttpServletResponse response ) throws IOException
{
- return createRootNode();
+ String location = response.encodeRedirectURL( "/resources" );
+ response.sendRedirect( ContextUtils.getRootPath( request ) + location );
}
@RequestMapping( value = "/", method = RequestMethod.GET )
- public @ResponseBody RootNode getIndexSlash()
+ public void getIndexWithSlash( HttpServletRequest request, HttpServletResponse response ) throws IOException
+ {
+ String location = response.encodeRedirectURL( "/resources" );
+ response.sendRedirect( ContextUtils.getRootPath( request ) + location );
+ }
+
+ @RequestMapping( value = "/resources", method = RequestMethod.GET )
+ public @ResponseBody RootNode getResources()
{
return createRootNode();
}