From 0984cda9ada641f4158fd5f37df59848ab81b26b Mon Sep 17 00:00:00 2001 From: Rafael da Silva Santos <62489286+Skan90@users.noreply.github.com> Date: Mon, 10 Oct 2022 18:08:53 -0300 Subject: [PATCH] APPLICATION_JSON_UTF8_VALUE is Deprecated From Documentation: "APPLICATION_JSON_UTF8_VALUE Deprecated. as of 5.2 in favor of APPLICATION_JSON_VALUE since major browsers like Chrome now comply with the specification and interpret correctly UTF-8 special characters without requiring a charset=UTF-8 parameter" https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/http/MediaType.html --- .../samples/petclinic/rest/OwnerRestController.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/springframework/samples/petclinic/rest/OwnerRestController.java b/src/main/java/org/springframework/samples/petclinic/rest/OwnerRestController.java index e3b3aadb..db41a451 100644 --- a/src/main/java/org/springframework/samples/petclinic/rest/OwnerRestController.java +++ b/src/main/java/org/springframework/samples/petclinic/rest/OwnerRestController.java @@ -50,7 +50,7 @@ public class OwnerRestController { @Autowired private ClinicService clinicService; - @RequestMapping(value = "/*/lastname/{lastName}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @RequestMapping(value = "/*/lastname/{lastName}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Collection<Owner>> getOwnersList(@PathVariable("lastName") String ownerLastName) { if (ownerLastName == null) { ownerLastName = ""; @@ -62,7 +62,7 @@ public class OwnerRestController { return new ResponseEntity<Collection<Owner>>(owners, HttpStatus.OK); } - @RequestMapping(value = "", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @RequestMapping(value = "", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Collection<Owner>> getOwners() { Collection<Owner> owners = this.clinicService.findAllOwners(); if (owners.isEmpty()) { @@ -71,7 +71,7 @@ public class OwnerRestController { return new ResponseEntity<Collection<Owner>>(owners, HttpStatus.OK); } - @RequestMapping(value = "/{ownerId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @RequestMapping(value = "/{ownerId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Owner> getOwner(@PathVariable("ownerId") int ownerId) { Owner owner = null; owner = this.clinicService.findOwnerById(ownerId); @@ -81,7 +81,7 @@ public class OwnerRestController { return new ResponseEntity<Owner>(owner, HttpStatus.OK); } - @RequestMapping(value = "", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @RequestMapping(value = "", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Owner> addOwner(@RequestBody @Valid Owner owner, BindingResult bindingResult, UriComponentsBuilder ucBuilder) { BindingErrorsResponse errors = new BindingErrorsResponse(); @@ -96,7 +96,7 @@ public class OwnerRestController { return new ResponseEntity<Owner>(owner, headers, HttpStatus.CREATED); } - @RequestMapping(value = "/{ownerId}", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @RequestMapping(value = "/{ownerId}", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Owner> updateOwner(@PathVariable("ownerId") int ownerId, @RequestBody @Valid Owner owner, BindingResult bindingResult, UriComponentsBuilder ucBuilder) { BindingErrorsResponse errors = new BindingErrorsResponse(); @@ -119,7 +119,7 @@ public class OwnerRestController { return new ResponseEntity<Owner>(currentOwner, HttpStatus.NO_CONTENT); } - @RequestMapping(value = "/{ownerId}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @RequestMapping(value = "/{ownerId}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE) @Transactional public ResponseEntity<Void> deleteOwner(@PathVariable("ownerId") int ownerId) { Owner owner = this.clinicService.findOwnerById(ownerId); -- GitLab