MCPcopy Index your code
hub / github.com/castello/spring_basic / write

Method write

ch4/CommentController.java:51–68  ·  view source on GitHub ↗
(@RequestBody CommentDto dto, Integer bno, HttpSession session)

Source from the content-addressed store, hash-verified

49// }
50 // 댓글을 등록하는 메서드
51 @PostMapping("/comments") // /ch4/comments?bno=1085 POST
52 public ResponseEntity<String> write(@RequestBody CommentDto dto, Integer bno, HttpSession session) {
53// String commenter = (String)session.getAttribute("id");
54 String commenter = "asdf";
55 dto.setCommenter(commenter);
56 dto.setBno(bno);
57 System.out.println("dto = " + dto);
58
59 try {
60 if(service.write(dto)!=1)
61 throw new Exception("Write failed.");
62
63 return new ResponseEntity<>("WRT_OK", HttpStatus.OK);
64 } catch (Exception e) {
65 e.printStackTrace();
66 return new ResponseEntity<String>("WRT_ERR", HttpStatus.BAD_REQUEST);
67 }
68 }
69
70 // 지정된 댓글을 삭제하는 메서드
71 @DeleteMapping("/comments/{cno}") // DELETE /comments/1?bno=1085 <-- 삭제할 댓글 번호

Callers

nothing calls this directly

Calls 3

setCommenterMethod · 0.80
writeMethod · 0.65
setBnoMethod · 0.45

Tested by

no test coverage detected