문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 다음 판 | 이전 판 다음 판 양쪽 다음 판 | ||
springframework:resttemplate [2020/07/20 14:57] kwon37xi |
springframework:resttemplate [2020/07/20 18:02] kwon37xi |
||
---|---|---|---|
줄 4: | 줄 4: | ||
* [[http:// | * [[http:// | ||
* [[https:// | * [[https:// | ||
+ | * [[https:// | ||
===== HttpEntity ===== | ===== HttpEntity ===== | ||
줄 66: | 줄 67: | ||
restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory())); | restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory())); | ||
restTemplate.setInterceptors(Lists.newArrayList(new RestTemplateLoggingInterceptor())); | restTemplate.setInterceptors(Lists.newArrayList(new RestTemplateLoggingInterceptor())); | ||
+ | </ | ||
+ | |||
+ | ===== SpringBoot ===== | ||
+ | * with [[springframework: | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | <code java> | ||
+ | @Bean | ||
+ | public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) { | ||
+ | return restTemplateBuilder | ||
+ | .requestFactory(() -> new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory())) | ||
+ | .setConnectTimeout(Duration.ofMillis(5000)) // connection-timeout | ||
+ | .setReadTimeout(Duration.ofMillis(5000)) // read-timeout | ||
+ | .additionalMessageConverters(new StringHttpMessageConverter(Charset.forName(" | ||
+ | .build(); | ||
+ | } | ||
</ | </ | ||
===== 참조 ===== | ===== 참조 ===== | ||
* [[https:// | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// |