diff --git a/pom.xml b/pom.xml
index 2a52a35..ba11727 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
com.lckp
jproxy
jar
- 2.6.2
+ 2.6.3
JProxy
http://maven.apache.org
diff --git a/release-logs.md b/release-logs.md
index c0e7629..633d21c 100644
--- a/release-logs.md
+++ b/release-logs.md
@@ -3,6 +3,9 @@
# Release Logs
+## v2.6.3 2022-09-02
+1. Fixed: replace WebClient with RestTemplate to solve request error sometime
+
## v2.6.2 2022-08-10
1. Fixed: can not format season and ep or date in search key while series type is Standard or Daily
diff --git a/release-logs.zh_CN.md b/release-logs.zh_CN.md
index 09724ec..592f642 100644
--- a/release-logs.zh_CN.md
+++ b/release-logs.zh_CN.md
@@ -3,6 +3,9 @@
# 发布日志
+## v2.6.3 2022-09-02
+1. 修复:使用 RestTemplate 代替 WebClient 以解决偶尔请求异常的问题
+
## v2.6.2 2022-08-10
1. 修复:当系列类型为:Standard, Daily 时,查询关键字季集,日期等参数无法格式化的问题
diff --git a/release/docker/config/sqlite.db b/release/docker/config/sqlite.db
index 0015e6b..5039dbd 100644
Binary files a/release/docker/config/sqlite.db and b/release/docker/config/sqlite.db differ
diff --git a/release/docker/jproxy.jar b/release/docker/jproxy.jar
index e18e231..2b8976f 100644
Binary files a/release/docker/jproxy.jar and b/release/docker/jproxy.jar differ
diff --git a/release/jar/config/application.yml b/release/jar/config/application.yml
index 220eb59..ecf06f6 100644
--- a/release/jar/config/application.yml
+++ b/release/jar/config/application.yml
@@ -7,7 +7,7 @@ spring:
project:
code: 'jproxy'
name: 'JProxy'
- version: '2.6.2'
+ version: '2.6.3'
server:
port: 8117
diff --git a/release/jar/config/sqlite.db b/release/jar/config/sqlite.db
index c4e0531..5039dbd 100644
Binary files a/release/jar/config/sqlite.db and b/release/jar/config/sqlite.db differ
diff --git a/release/jar/jproxy.jar b/release/jar/jproxy.jar
index c404097..8d8ee58 100644
Binary files a/release/jar/jproxy.jar and b/release/jar/jproxy.jar differ
diff --git a/release/server/config/application.yml b/release/server/config/application.yml
index 220eb59..ecf06f6 100644
--- a/release/server/config/application.yml
+++ b/release/server/config/application.yml
@@ -7,7 +7,7 @@ spring:
project:
code: 'jproxy'
name: 'JProxy'
- version: '2.6.2'
+ version: '2.6.3'
server:
port: 8117
diff --git a/release/server/config/sqlite.db b/release/server/config/sqlite.db
index 0015e6b..5039dbd 100644
Binary files a/release/server/config/sqlite.db and b/release/server/config/sqlite.db differ
diff --git a/release/server/jproxy.jar b/release/server/jproxy.jar
index 0a0cb2d..850b24d 100644
Binary files a/release/server/jproxy.jar and b/release/server/jproxy.jar differ
diff --git a/src/main/java/com/lckp/controller/PageController.java b/src/main/java/com/lckp/controller/PageController.java
index 58c7c52..2e5e69b 100644
--- a/src/main/java/com/lckp/controller/PageController.java
+++ b/src/main/java/com/lckp/controller/PageController.java
@@ -16,14 +16,14 @@
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.reactive.function.client.ClientResponse;
-import org.springframework.web.reactive.function.client.WebClient;
+import org.springframework.web.client.RestTemplate;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
@@ -33,7 +33,6 @@
import com.lckp.interceptor.LoginInterceptor;
import io.swagger.annotations.Api;
-import reactor.core.publisher.Mono;
/**
* @ClassName: PageController
@@ -133,11 +132,10 @@ public Object notice(Model model, Locale locale) throws IOException {
LOGGER.info("noticeLocation: {}", noticeLocation);
if (!noticeLocation.startsWith("classpath")) {
try {
- WebClient webClient = WebClient.create();
- Mono mono = webClient.get().uri(noticeLocation).exchange();
- ClientResponse response = mono.block();
- if (HttpStatus.OK == response.statusCode()) {
- return response.bodyToMono(String.class).block();
+ RestTemplate restTemplate = new RestTemplate();
+ ResponseEntity response = restTemplate.getForEntity(noticeLocation, String.class);
+ if (response.getStatusCode() == HttpStatus.OK) {
+ return response.getBody();
}
LOGGER.error("notice request fail: ", JSON.toJSONString(response));
} catch (Exception e) {
diff --git a/src/main/java/com/lckp/service/spring/RuleMarketClientServiceImpl.java b/src/main/java/com/lckp/service/spring/RuleMarketClientServiceImpl.java
index 7f2b4e6..6c1748b 100644
--- a/src/main/java/com/lckp/service/spring/RuleMarketClientServiceImpl.java
+++ b/src/main/java/com/lckp/service/spring/RuleMarketClientServiceImpl.java
@@ -11,11 +11,13 @@
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
-import org.springframework.web.reactive.function.client.ClientResponse;
-import org.springframework.web.reactive.function.client.WebClient;
+import org.springframework.web.client.RestTemplate;
import com.alibaba.fastjson.JSON;
import com.lckp.mapper.IRuleMarketClientMapper;
@@ -24,8 +26,6 @@
import com.lckp.resp.RuleMarketServerShareResp;
import com.lckp.service.facade.IRuleMarketClientService;
-import reactor.core.publisher.Mono;
-
/**
* @ClassName: RuleMarketClientServiceImpl
* @Description: 规则市场客户端serviceImpl
@@ -79,15 +79,13 @@ public int queryDownloadStatus(String ruleId) {
public String post(String path, Object param) {
path = clientToServer(path);
LOGGER.debug("post: {}, {}", path, JSON.toJSONString(param));
- WebClient webClient = WebClient.create();
- Mono mono = webClient
- .post()
- .uri(ruleMarketApi + path)
- .header("timestamp", String.valueOf(System.currentTimeMillis()))
- .contentType(MediaType.APPLICATION_JSON)
- .bodyValue(param)
- .exchange();
- String responseBody = mono.block().bodyToMono(String.class).block();
+ RestTemplate restTemplate = new RestTemplate();
+ HttpHeaders headers = new HttpHeaders();
+ headers.setContentType(MediaType.APPLICATION_JSON);
+ headers.add("timestamp", String.valueOf(System.currentTimeMillis()));
+ HttpEntity