The client sends a request to the REST server to delete the record. Angular Performance
$scope.deleteItem = function(id) { var url = 'http://localhost:8080/api/message/' + id; var config = { headers: {'Content-Type': 'application/json'}}; $http.delete(url, config).then(function(response){ console.log(response); }, function(response){ console.log(response); }); Spring server side boot
@RequestMapping( value = "api/message/{id}", method = RequestMethod.DELETE, consumes = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<?> deleteMessage(@PathVariable Long id) { if (!messageService.delete(id)) { throw new DataNotFoundException("Data with id=" + id + " not found."); } return ResponseEntity.ok("Successfully deleted user"); } Returns the text, this is a stub, in fact, I do not know yet what to return correctly in this case, according to the true idea, although Angular can check the answer and with the line == "done". In general, if you give extra. advice then thanks.
Now I get a response on the server side:
Resolved exception caused by Handler execution: org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'null' not supported
Browser console log:
DELETE http://localhost:8080/api/message/1 415 config: Object data: Object headers: (d) status: 415 statusText: "" What am I doing wrong?
"api/message/{id}"null"api/message/{id}"? Deletion from the database occurs? - JVic