コード例 #1
0
 @RequestMapping(
     value = "/speeches/{id}",
     method = PUT,
     consumes = MediaType.APPLICATION_JSON_VALUE,
     produces = MediaType.APPLICATION_JSON_VALUE)
 public Speech update(@PathVariable("id") Long id, @RequestBody @Validated Speech speech) {
   speech.setId(id);
   return speechService.update(speech);
 }
コード例 #2
0
 @RequestMapping(
     value = "/speakers/{id}/speeches",
     method = POST,
     consumes = MediaType.APPLICATION_JSON_VALUE,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @ResponseStatus(HttpStatus.CREATED)
 public Speech createAndLinkToSpeaker(
     @PathVariable("id") Long speakerId, @RequestBody @Validated Speech speech) {
   speech.setId(null);
   Speaker speaker = speakerService.findById(speakerId);
   return speechService.createAndLinkToSpeaker(speech, speaker);
 }