Rest service return ResourceId after the creation.

This commit is contained in:
Paulo Gustavo Veiga 2012-04-06 20:28:25 -03:00
parent 70b8fe8727
commit e4dc4a50aa
2 changed files with 3 additions and 3 deletions

View File

@ -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"})

View File

@ -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() {