Open webcane opened 7 years ago
что использовать:
или
redirect на новый элемент после его создания
@RequestMapping(value= "/person", method = RequestMethod.POST) public ResponseEntity<Void> addPerson(@RequestBody Person person, UriComponentsBuilder builder) { boolean flag = personService.addPerson(person); if (flag == false) { return new ResponseEntity<Void>(HttpStatus.CONFLICT); } HttpHeaders headers = new HttpHeaders(); headers.setLocation(builder.path("/person/{id}").buildAndExpand(person.getPid()).toUri()); return new ResponseEntity<Void>(headers, HttpStatus.CREATED); }
админка: