Fixed ContentType JSON-UTF8 issue

This commit is contained in:
Panagiotis Kanakakis 2019-03-21 12:53:04 +00:00
parent 0b69cc53a2
commit d393be9432
1 changed files with 9 additions and 2 deletions

View File

@ -118,7 +118,8 @@ public class RepositoryServiceImpl implements RepositoryService {
LOGGER.debug("Updated version!");
httpHeaders = new HttpHeaders();
httpHeaders.set("Content-Type", "application/json");
httpHeaders.setContentType(MediaType.APPLICATION_JSON_UTF8);
// httpHeaders.set("Content-Type", "application/json");
for (String vocName : vocabularyNames) {
vocabularyMap.put(vocName, vocabularyLoader.getVocabulary(vocName, Locale.ENGLISH, Locale.ROOT));
@ -411,6 +412,11 @@ public class RepositoryServiceImpl implements RepositoryService {
String json_repository = Converter.repositoryObjectToJson(repository);
LOGGER.debug("JSON to add(update) -> " + json_repository);
//
// // TODO delete these 3 lines
// HttpHeaders temp = new HttpHeaders();
// temp.setContentType(MediaType.APPLICATION_JSON_UTF8);
HttpEntity<String> httpEntity = new HttpEntity<String>(json_repository, httpHeaders);
ResponseEntity responseEntity = restTemplate.exchange(uriComponents.toUri(),HttpMethod.POST, httpEntity, ResponseEntity.class);
@ -442,7 +448,8 @@ public class RepositoryServiceImpl implements RepositoryService {
LOGGER.debug("JSON to update -> " + json_repository);
HttpEntity<String> httpEntity = new HttpEntity<String>(json_repository, httpHeaders);
ResponseEntity responseEntity = restTemplate.exchange(uriComponents.toUri(),HttpMethod.POST, httpEntity, ResponseEntity.class);
ResponseEntity responseEntity = restTemplate.exchange(uriComponents.toUri(),HttpMethod.POST, httpEntity
, ResponseEntity.class);
if (responseEntity.getStatusCode().equals(HttpStatus.OK))
emailUtils.sendUserUpdateRepositoryEmail(repository, authentication);