diff --git a/wise-webapp/pom.xml b/wise-webapp/pom.xml index 40cc3c0a..7f7f07d2 100644 --- a/wise-webapp/pom.xml +++ b/wise-webapp/pom.xml @@ -261,8 +261,14 @@ jackson-mapper-asl 1.9.4 + + com.thoughtworks.xstream + xstream + 1.3.1 + + 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 c241a71b..a9ce9bc6 100644 --- a/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java +++ b/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java @@ -2,43 +2,32 @@ package com.wisemapping.rest; import com.wisemapping.model.MindMap; +import com.wisemapping.rest.model.RestMindMap; import com.wisemapping.service.MindmapService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.servlet.ModelAndView; import java.io.IOException; import java.util.HashMap; import java.util.Map; @Controller +@RequestMapping("/map") public class MindmapController { + @Autowired private MindmapService mindmapService; - public void setMindmapService(MindmapService mindmapService) { - this.mindmapService = mindmapService; - } - @RequestMapping(method = RequestMethod.GET, value = "/map/{id}") - public + @RequestMapping(method = RequestMethod.GET, value = "/{id}") @ResponseBody - Map getMindmap(@PathVariable int id) throws IOException { - final Map result = new HashMap(); + public ModelAndView getMindmap(@PathVariable int id) throws IOException { final MindMap mindMap = mindmapService.getMindmapById(id); - result.put("xml", mindMap.getNativeXml()); - result.put("creationTime", mindMap.getCreationTime()); - result.put("description", mindMap.getDescription()); - result.put("lastModification", mindMap.getLastModificationDate()); - result.put("owner", mindMap.getOwner().getUsername()); - return result; + final RestMindMap map = new RestMindMap(mindMap); + return new ModelAndView("mapView", "map", map); } - - @RequestMapping(method = RequestMethod.POST, value = "/map/{id}") - public void updateMindmap(@PathVariable int id) throws IOException { - - } - - } diff --git a/wise-webapp/src/main/webapp/WEB-INF/jsp-rest/map.jsp b/wise-webapp/src/main/webapp/WEB-INF/jsp-rest/mapView.jsp similarity index 100% rename from wise-webapp/src/main/webapp/WEB-INF/jsp-rest/map.jsp rename to wise-webapp/src/main/webapp/WEB-INF/jsp-rest/mapView.jsp diff --git a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-rest.xml b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-rest.xml index 6a4277a3..85e5f1d4 100644 --- a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-rest.xml +++ b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-rest.xml @@ -2,67 +2,61 @@ + http://www.springframework.org/schema/context + http://www.springframework.org/schema/context/spring-context-3.1.xsd + http://www.springframework.org/schema/mvc + http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd"> + + + + - - + + - + + + + com.wisemapping.rest.model.RestMindMap + + + + + + + + + - - - + - - - - + - - + + + + - - - - - - - - - - - - - - java.util.HashMap - - - - - - - - \ No newline at end of file