Ejemplo n.º 1
0
 /**
  * POST /addresses { "text": "text of the address" }
  *
  * <p>Creates a new address.
  *
  * @param json
  * @return json containing the id of the newly created address
  */
 @RequestMapping(method = RequestMethod.POST, headers = "Accept=application/json")
 public ResponseEntity<String> createFromJson(@RequestBody String json) {
   Address createdAddress = addresses.save(Address.fromJsonToAddress(json));
   HttpHeaders headers = new HttpHeaders();
   headers.add("Content-Type", "application/text");
   return new ResponseEntity<String>(
       "{\"id\":" + createdAddress.getId() + "}", headers, HttpStatus.CREATED);
 }