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 974a67da..3bb21bfe 100644 --- a/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java +++ b/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java @@ -182,6 +182,15 @@ public class MindmapController extends BaseController { return mindmap.getXmlStr().getBytes("UTF-8"); } + @RequestMapping(method = RequestMethod.GET, value = { "/maps/{id}/{hid}/document/xml"},consumes = {"text/plain"}, produces = {"application/xml"}) + @ResponseBody + public byte[] retrieveDocument(@PathVariable int id, @PathVariable int hid,@NotNull HttpServletResponse response) throws WiseMappingException, IOException { + // I should not return byte, but there is some encoding issue here. Further research needed. + response.setCharacterEncoding("UTF-8"); + final MindMapHistory mindmapHistory = mindmapService.findMindmapHistory(id, hid); + return mindmapHistory.getXml(); + } + private void verifyLock(@NotNull Mindmap mindmap, @NotNull User user, long session, long timestamp) throws WiseMappingException { diff --git a/wise-webapp/src/main/java/com/wisemapping/webmvc/MindmapController.java b/wise-webapp/src/main/java/com/wisemapping/webmvc/MindmapController.java index 8c446f6a..35c456f1 100644 --- a/wise-webapp/src/main/java/com/wisemapping/webmvc/MindmapController.java +++ b/wise-webapp/src/main/java/com/wisemapping/webmvc/MindmapController.java @@ -194,12 +194,7 @@ public class MindmapController { final String result = showMindmapEditorPage(id, model); model.addAttribute("readOnlyMode", true); - - // Change map XML .... - final MindMapBean mindmapBean = (MindMapBean) model.asMap().get("mindmap"); - final MindMapHistory mindmapHistory = mindmapService.findMindmapHistory(id, hid); - mindmapBean.getDelegated().setXml(mindmapHistory.getXml()); - + model.addAttribute("hid",hid); return result; } diff --git a/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp b/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp index 06f54625..ca3a9582 100644 --- a/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp +++ b/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp @@ -45,7 +45,7 @@ ); - options.persistenceManager = new mindplot.LocalStorageManager("c/restful/maps/{id}/document/xml${principal!=null?'':'-pub'}"); + options.persistenceManager = new mindplot.LocalStorageManager("c/restful/maps/{id}${hid!=null?'/'+hid:''}/document/xml${principal!=null?'':'-pub'}"); var userOptions = ${mindmap.properties};