@RequestMapping(value = "/links/addunder/{categoryName}", method = GET) public String addCategory( Model model, @PathVariable(value = "categoryName") String categoryName) { Link link = new Link(); link.setCategoryName(categoryName); model.addAttribute("link", link); return "datastore/link"; }
@RequestMapping(value = "/api/links", method = POST) @ResponseBody public Link create(@RequestBody Link link) { LOGGER.info("Creating new links {}", link); if (link.getParentLinkName() != null && link.getParentLinkName().trim().length() != 0) { Link parentLink = linkManager.getLink(link.getParentLinkName()); link.setCategoryName(parentLink.getCategoryName()); } return linkManager.add(link); }