From e4dc4a50aaa18ccfb0cd002fb32cfe4f6efbed25 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Fri, 6 Apr 2012 20:28:25 -0300 Subject: [PATCH] Rest service return ResourceId after the creation. --- .../src/main/java/com/wisemapping/rest/MindmapController.java | 3 ++- wise-webapp/src/main/webapp/jsp/mindmapList.jsp | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java b/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java index fd694392..ca79fd7b 100644 --- a/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java +++ b/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java @@ -183,9 +183,10 @@ public class MindmapController extends BaseController { // Add new mindmap ... mindmapService.addMindmap(delegated, user); - // Return the new created map ... response.setHeader("Location", "/service/maps/" + delegated.getId()); + response.setHeader("ResourceId", Integer.toString(delegated.getId())); + } @RequestMapping(method = RequestMethod.POST, value = "/maps/{id}", consumes = {"application/xml", "application/json"}) diff --git a/wise-webapp/src/main/webapp/jsp/mindmapList.jsp b/wise-webapp/src/main/webapp/jsp/mindmapList.jsp index 9d618a4a..2d0e4a70 100644 --- a/wise-webapp/src/main/webapp/jsp/mindmapList.jsp +++ b/wise-webapp/src/main/webapp/jsp/mindmapList.jsp @@ -177,8 +177,7 @@ type: 'POST', contentType:"application/json; charset=utf-8", success : function(data, textStatus, jqXHR) { - var location = jqXHR.getResponseHeader("Location"); - var mapId = location.substring(location.lastIndexOf('/') + 1, location.length); + var mapId = jqXHR.getResponseHeader("ResourceId"); window.location = "c/editor.htm?action=open&mapId=" + mapId; }, error: function() {