(improvement)(launcher) upgrade to the latest httpclient&core to support "LaxRedirectStrategy"

This commit is contained in:
wua.ming
2024-11-13 10:17:55 +08:00
parent d9b9932820
commit df22cdf7b5
2 changed files with 6 additions and 7 deletions

View File

@@ -2,8 +2,7 @@ package com.tencent.supersonic.config;
import org.apache.hc.client5.http.impl.DefaultRedirectStrategy;
//import org.apache.hc.client5.http.impl.LaxRedirectStrategy;
import org.apache.hc.client5.http.impl.LaxRedirectStrategy;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
import org.springframework.context.annotation.Bean;
@@ -22,8 +21,8 @@ public class RestTemplateConfig {
// HttpClient 5 较新版本才会有LaxRedirectStrategy, 所以我重新定义了
CloseableHttpClient httpClient =
HttpClientBuilder.create().setRedirectStrategy(new DefaultRedirectStrategy()) // 使用宽松重定向策略
//HttpClientBuilder.create().setRedirectStrategy(new LaxRedirectStrategy()) // 使用宽松重定向策略
//HttpClientBuilder.create().setRedirectStrategy(new DefaultRedirectStrategy()) // 使用宽松重定向策略
HttpClientBuilder.create().setRedirectStrategy(new LaxRedirectStrategy()) // 使用宽松重定向策略
.build();
HttpComponentsClientHttpRequestFactory httpRequestFactory =