Fakultas Ilmu Komputer UI

Skip to content
Snippets Groups Projects
Unverified Commit 2bf1accd authored by Rafael da Silva Santos's avatar Rafael da Silva Santos Committed by GitHub
Browse files

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
parent a1df7a5f
No related branches found
No related tags found
No related merge requests found
...@@ -51,7 +51,7 @@ public class PetRestController { ...@@ -51,7 +51,7 @@ public class PetRestController {
@Autowired @Autowired
private ClinicService clinicService; private ClinicService clinicService;
@RequestMapping(value = "/{petId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/{petId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Pet> getPet(@PathVariable("petId") int petId){ public ResponseEntity<Pet> getPet(@PathVariable("petId") int petId){
Pet pet = this.clinicService.findPetById(petId); Pet pet = this.clinicService.findPetById(petId);
if(pet == null){ if(pet == null){
...@@ -60,7 +60,7 @@ public class PetRestController { ...@@ -60,7 +60,7 @@ public class PetRestController {
return new ResponseEntity<Pet>(pet, HttpStatus.OK); return new ResponseEntity<Pet>(pet, 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<Pet>> getPets(){ public ResponseEntity<Collection<Pet>> getPets(){
Collection<Pet> pets = this.clinicService.findAllPets(); Collection<Pet> pets = this.clinicService.findAllPets();
if(pets.isEmpty()){ if(pets.isEmpty()){
...@@ -69,12 +69,12 @@ public class PetRestController { ...@@ -69,12 +69,12 @@ public class PetRestController {
return new ResponseEntity<Collection<Pet>>(pets, HttpStatus.OK); return new ResponseEntity<Collection<Pet>>(pets, HttpStatus.OK);
} }
@RequestMapping(value = "/pettypes", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/pettypes", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Collection<PetType>> getPetTypes(){ public ResponseEntity<Collection<PetType>> getPetTypes(){
return new ResponseEntity<Collection<PetType>>(this.clinicService.findPetTypes(), HttpStatus.OK); return new ResponseEntity<Collection<PetType>>(this.clinicService.findPetTypes(), 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<Pet> addPet(@RequestBody @Valid Pet pet, BindingResult bindingResult, UriComponentsBuilder ucBuilder){ public ResponseEntity<Pet> addPet(@RequestBody @Valid Pet pet, BindingResult bindingResult, UriComponentsBuilder ucBuilder){
BindingErrorsResponse errors = new BindingErrorsResponse(); BindingErrorsResponse errors = new BindingErrorsResponse();
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
...@@ -88,7 +88,7 @@ public class PetRestController { ...@@ -88,7 +88,7 @@ public class PetRestController {
return new ResponseEntity<Pet>(pet, headers, HttpStatus.CREATED); return new ResponseEntity<Pet>(pet, headers, HttpStatus.CREATED);
} }
@RequestMapping(value = "/{petId}", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/{petId}", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Pet> updatePet(@PathVariable("petId") int petId, @RequestBody @Valid Pet pet, BindingResult bindingResult){ public ResponseEntity<Pet> updatePet(@PathVariable("petId") int petId, @RequestBody @Valid Pet pet, BindingResult bindingResult){
BindingErrorsResponse errors = new BindingErrorsResponse(); BindingErrorsResponse errors = new BindingErrorsResponse();
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
...@@ -109,7 +109,7 @@ public class PetRestController { ...@@ -109,7 +109,7 @@ public class PetRestController {
return new ResponseEntity<Pet>(currentPet, HttpStatus.NO_CONTENT); return new ResponseEntity<Pet>(currentPet, HttpStatus.NO_CONTENT);
} }
@RequestMapping(value = "/{petId}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/{petId}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
@Transactional @Transactional
public ResponseEntity<Void> deletePet(@PathVariable("petId") int petId){ public ResponseEntity<Void> deletePet(@PathVariable("petId") int petId){
Pet pet = this.clinicService.findPetById(petId); Pet pet = this.clinicService.findPetById(petId);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment