From 74740d5d989f11746266a994840f89e9f6784f73 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 19 Nov 2018 23:03:53 +0300 Subject: trying to switch ActivityPub RestTemplate to OkHttp --- build.gradle | 1 + .../com/juick/server/configuration/ActivityPubClientConfig.java | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index a1cc6098..f8b3544b 100644 --- a/build.gradle +++ b/build.gradle @@ -164,6 +164,7 @@ dependencies { compile 'com.atlassian.commonmark:commonmark:0.12.1' compile 'com.atlassian.commonmark:commonmark-ext-autolink:0.12.1' compile 'org.tomitribe:tomitribe-http-signatures:1.1' + compile 'com.squareup.okhttp3:okhttp:3.11.0' testCompile("org.springframework.boot:spring-boot-starter-test") testCompile('net.sourceforge.htmlunit:htmlunit:2.33') diff --git a/src/main/java/com/juick/server/configuration/ActivityPubClientConfig.java b/src/main/java/com/juick/server/configuration/ActivityPubClientConfig.java index 9bc1b656..43b638fe 100644 --- a/src/main/java/com/juick/server/configuration/ActivityPubClientConfig.java +++ b/src/main/java/com/juick/server/configuration/ActivityPubClientConfig.java @@ -2,7 +2,7 @@ package com.juick.server.configuration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.http.client.SimpleClientHttpRequestFactory; +import org.springframework.http.client.OkHttp3ClientHttpRequestFactory; import org.springframework.web.client.RestTemplate; import javax.inject.Inject; @@ -13,9 +13,7 @@ public class ActivityPubClientConfig { ActivityPubClientErrorHandler activityPubClientErrorHandler; @Bean public RestTemplate apClient() { - SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); - requestFactory.setOutputStreaming(false); - RestTemplate restTemplate = new RestTemplate(requestFactory); + RestTemplate restTemplate = new RestTemplate(new OkHttp3ClientHttpRequestFactory()); restTemplate.setErrorHandler(activityPubClientErrorHandler); return restTemplate; } -- cgit v1.2.3