diff --git a/wise-webapp/src/main/java/com/wisemapping/model/MindMapHistory.java b/wise-webapp/src/main/java/com/wisemapping/model/MindMapHistory.java index 234c66fc..d2cda181 100755 --- a/wise-webapp/src/main/java/com/wisemapping/model/MindMapHistory.java +++ b/wise-webapp/src/main/java/com/wisemapping/model/MindMapHistory.java @@ -18,8 +18,10 @@ package com.wisemapping.model; +import com.wisemapping.util.ZipUtils; import org.jetbrains.annotations.Nullable; +import java.io.IOException; import java.util.Calendar; public class MindMapHistory { @@ -71,7 +73,7 @@ public class MindMapHistory { return xml; } - public void setXml(byte[] xml) { - this.xml = xml; + public byte[] getUnzipXml() throws IOException { + return ZipUtils.zipToBytes(xml); } } 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 3bb21bfe..cfddc4ff 100644 --- a/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java +++ b/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java @@ -120,7 +120,7 @@ public class MindmapController extends BaseController { @RequestMapping(value = "maps/{id}/history/{hid}", method = RequestMethod.POST) @ResponseStatus(value = HttpStatus.NO_CONTENT) - public void updateRevertMindmap(@PathVariable int id, @PathVariable String hid) throws WiseMappingException { + public void updateRevertMindmap(@PathVariable int id, @PathVariable String hid) throws WiseMappingException, IOException { final Mindmap mindmap = mindmapService.findMindmapById(id); final User user = Utils.getUser(); @@ -129,7 +129,7 @@ public class MindmapController extends BaseController { List mindmapHistory = mindmapService.findMindmapHistory(id); if (mindmapHistory.size() > 0) { final MindMapHistory mindMapHistory = mindmapHistory.get(0); - mindmap.setXml(mindMapHistory.getXml()); + mindmap.setZippedXml(mindMapHistory.getXml()); saveMindmapDocument(true, mindmap, user); } } else { @@ -188,7 +188,7 @@ public class MindmapController extends BaseController { // 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(); + return mindmapHistory.getUnzipXml(); } diff --git a/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp b/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp index ca3a9582..844a77a6 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}${hid!=null?'/'+hid:''}/document/xml${principal!=null?'':'-pub'}"); + options.persistenceManager = new mindplot.LocalStorageManager("c/restful/maps/{id}${hid!=null?'/':''}${hid!=null?hid:''}/document/xml${principal!=null?'':'-pub'}"); var userOptions = ${mindmap.properties};