@RequestMapping(value = "/page", method = RequestMethod.POST) @ResponseStatus(HttpStatus.CREATED) @ResponseBody public WebPage addWebPage(@Valid @RequestBody WebPage webpage) { dao.addWebPage(webpage); return webpage; }
@RequestMapping(value = "/page/{id}", method = RequestMethod.DELETE) @ResponseBody public void deleteWebPage(@PathVariable("id") int id) { dao.deleteWebPage(dao.getWebPageById(id)); }
@RequestMapping(value = "/page/{id}", method = RequestMethod.PUT) @ResponseStatus(HttpStatus.NO_CONTENT) public void saveWebPage(@PathVariable("id") int id, @Valid @RequestBody WebPage webpage) { webpage.setPageID(id); dao.updateWebPage(webpage); }
@RequestMapping(value = "/pages", method = RequestMethod.GET) @ResponseBody public List<WebPage> getAllWebPages() { return dao.getAllWebPages(); }