aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/server/configuration/ActivityPubClientConfig.java
blob: 9bc1b656ce16b7d07ad21db0f876455d6a5057d8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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.web.client.RestTemplate;

import javax.inject.Inject;

@Configuration
public class ActivityPubClientConfig {
    @Inject
    ActivityPubClientErrorHandler activityPubClientErrorHandler;
    @Bean
    public RestTemplate apClient() {
        SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
        requestFactory.setOutputStreaming(false);
        RestTemplate restTemplate = new RestTemplate(requestFactory);
        restTemplate.setErrorHandler(activityPubClientErrorHandler);
        return restTemplate;
    }
}