MCPcopy Create free account
hub / github.com/castello/spring_basic / modify

Method modify

ch4/CommentController.java:27–44  ·  view source on GitHub ↗
(@PathVariable Integer cno, @RequestBody CommentDto dto)

Source from the content-addressed store, hash-verified

25// }
26 // 댓글을 수정하는 메서드
27 @PatchMapping("/comments/{cno}") // /ch4/comments/26 PATCH
28 public ResponseEntity<String> modify(@PathVariable Integer cno, @RequestBody CommentDto dto) {
29// String commenter = (String)session.getAttribute("id");
30 String commenter = "asdf";
31 dto.setCommenter(commenter);
32 dto.setCno(cno);
33 System.out.println("dto = " + dto);
34
35 try {
36 if(service.modify(dto)!=1)
37 throw new Exception("Write failed.");
38
39 return new ResponseEntity<>("MOD_OK", HttpStatus.OK);
40 } catch (Exception e) {
41 e.printStackTrace();
42 return new ResponseEntity<String>("MOD_ERR", HttpStatus.BAD_REQUEST);
43 }
44 }
45
46// {
47// "pcno":0,

Callers

nothing calls this directly

Calls 3

setCommenterMethod · 0.80
setCnoMethod · 0.80
modifyMethod · 0.65

Tested by

no test coverage detected