aboutsummaryrefslogtreecommitdiff
path: root/juick-server
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-11-01 11:56:59 +0300
committerGravatar Vitaly Takmazov2018-11-01 11:56:59 +0300
commit72b9b677d9f361ebbf963e7e1cf95f287e0315ea (patch)
tree7951c22e3697e2557001821aba95b57e9e86786c /juick-server
parent0a9c938038a38bf565882de44f8a77f6b5bf353d (diff)
drop resttemplate cache
Diffstat (limited to 'juick-server')
-rw-r--r--juick-server/build.gradle1
-rw-r--r--juick-server/src/main/java/com/juick/server/configuration/ActivityPubClientConfig.java24
2 files changed, 0 insertions, 25 deletions
diff --git a/juick-server/build.gradle b/juick-server/build.gradle
index 90ed90a3..e9415548 100644
--- a/juick-server/build.gradle
+++ b/juick-server/build.gradle
@@ -66,7 +66,6 @@ dependencies {
compile ('org.springframework.boot:spring-boot-starter-jdbc')
compile("org.springframework.boot:spring-boot-starter-security")
compile("org.springframework.boot:spring-boot-starter-web")
- compile 'org.apache.httpcomponents:httpclient-cache'
compile("org.springframework.boot:spring-boot-starter-websocket")
compile 'org.springframework.boot:spring-boot-devtools'
diff --git a/juick-server/src/main/java/com/juick/server/configuration/ActivityPubClientConfig.java b/juick-server/src/main/java/com/juick/server/configuration/ActivityPubClientConfig.java
index 37afc1d8..12626b59 100644
--- a/juick-server/src/main/java/com/juick/server/configuration/ActivityPubClientConfig.java
+++ b/juick-server/src/main/java/com/juick/server/configuration/ActivityPubClientConfig.java
@@ -1,13 +1,8 @@
package com.juick.server.configuration;
import com.juick.server.ActivityPubManager;
-import org.apache.http.client.HttpClient;
-import org.apache.http.impl.client.cache.CacheConfig;
-import org.apache.http.impl.client.cache.CachingHttpClientBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import org.springframework.http.client.BufferingClientHttpRequestFactory;
-import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;
@@ -17,26 +12,7 @@ public class ActivityPubClientConfig {
public RestTemplate apClient() {
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
RestTemplate restTemplate = new RestTemplate(requestFactory);
- // BufferingClientHttpRequestFactory allows us to read the response more than once - Necessary for debugging.
- restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory(httpClient())));
restTemplate.setErrorHandler(new ActivityPubManager.ErrorHandler());
return restTemplate;
}
- @Bean
- public HttpClient httpClient() {
- return CachingHttpClientBuilder
- .create()
- .setCacheConfig(cacheConfig())
- .build();
- }
- @Bean
- public CacheConfig cacheConfig() {
- return CacheConfig
- .custom()
- .setMaxObjectSize(500000) // 500KB
- .setMaxCacheEntries(2000)
- // Set this to false and a response with queryString
- // will be cached when it is explicitly cacheable .setNeverCacheHTTP10ResponsesWithQueryString(false)
- .build();
- }
} \ No newline at end of file