diff options
Diffstat (limited to 'src/main/java/com/juick/server')
-rw-r--r-- | src/main/java/com/juick/server/configuration/ActivityPubClientConfig.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main/java/com/juick/server/configuration/ActivityPubClientConfig.java b/src/main/java/com/juick/server/configuration/ActivityPubClientConfig.java index d7d49355..65bfeade 100644 --- a/src/main/java/com/juick/server/configuration/ActivityPubClientConfig.java +++ b/src/main/java/com/juick/server/configuration/ActivityPubClientConfig.java @@ -1,9 +1,11 @@ package com.juick.server.configuration; +import com.fasterxml.jackson.databind.ObjectMapper; import com.juick.server.api.activity.model.Activity; import com.juick.server.helpers.HeaderRequestInterceptor; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.web.client.RestTemplate; import javax.inject.Inject; @@ -13,9 +15,18 @@ import java.util.Collections; public class ActivityPubClientConfig { @Inject ActivityPubClientErrorHandler activityPubClientErrorHandler; + @Inject + ObjectMapper jsonMapper; + @Bean + public MappingJackson2HttpMessageConverter mappingJacksonHttpMessageConverter() { + MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); + converter.setObjectMapper(jsonMapper); + return converter; + } @Bean public RestTemplate apClient() { RestTemplate restTemplate = new RestTemplate(); + restTemplate.getMessageConverters().add(0, mappingJacksonHttpMessageConverter()); restTemplate.setErrorHandler(activityPubClientErrorHandler); restTemplate.setInterceptors(Collections.singletonList( new HeaderRequestInterceptor("Accept", Activity.ACTIVITY_MEDIA_TYPE))); |