@RequestMapping(value = "/deletePost/{id}", method = RequestMethod.GET) public String deleteComment(@PathVariable(value = "id") int postId) { WallPost post = postService.getPost(postId); List<Comment> commentListOnThisPost = commentService.getAllCommentsOnPost(post); commentService.deleteComment(commentListOnThisPost); postService.deletePost(post); return "redirect:/posts"; }
@RequestMapping(value = "/playAudio/{id}") public void playAudio(HttpServletResponse response, @PathVariable(value = "id") int id) { log.debug("in audio streaming, id = {}", id); WallPost post = postService.getPost(id); OutputStream output = null; try { output = response.getOutputStream(); response.setContentType(post.getAudioContentType()); output.write(post.getAudioContent()); output.flush(); } catch (IOException e) { e.printStackTrace(); } finally { try { output.close(); } catch (IOException e) { } } }