mirror of
https://gitee.com/dromara/sa-token.git
synced 2025-09-18 17:48:03 +08:00
SSO 示例项目 http 请求工具改为 Forest
This commit is contained in:
@@ -60,10 +60,11 @@
|
||||
|
||||
<!-- Http请求工具(在模式三的单点注销功能下用到,如不需要可以注释掉) -->
|
||||
<dependency>
|
||||
<groupId>com.ejlchina</groupId>
|
||||
<artifactId>okhttps</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<groupId>com.dtflys.forest</groupId>
|
||||
<artifactId>forest-spring-boot-starter</artifactId>
|
||||
<version>1.5.26</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
@@ -5,7 +5,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.ejlchina.okhttps.OkHttps;
|
||||
import com.dtflys.forest.Forest;
|
||||
|
||||
import cn.dev33.satoken.config.SaSsoConfig;
|
||||
import cn.dev33.satoken.sso.SaSsoHandle;
|
||||
@@ -55,8 +55,8 @@ public class SsoServerController {
|
||||
sso.setSendHttp(url -> {
|
||||
try {
|
||||
// 发起 http 请求
|
||||
System.out.println("发起请求:" + url);
|
||||
return OkHttps.sync(url).get().getBody().toString();
|
||||
System.out.println("------ 发起请求:" + url);
|
||||
return Forest.get(url).executeAsString();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
|
@@ -49,8 +49,10 @@ spring:
|
||||
# 连接池中的最小空闲连接
|
||||
min-idle: 0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
forest:
|
||||
# 关闭 forest 请求日志打印
|
||||
log-enabled: false
|
||||
|
||||
|
||||
|
||||
|
@@ -26,7 +26,7 @@
|
||||
<dependency>
|
||||
<groupId>com.dtflys.forest</groupId>
|
||||
<artifactId>forest-spring-boot-starter</artifactId>
|
||||
<version>1.5.19</version>
|
||||
<version>1.5.26</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
@@ -56,9 +56,9 @@
|
||||
|
||||
<!-- Http请求工具 -->
|
||||
<dependency>
|
||||
<groupId>com.ejlchina</groupId>
|
||||
<artifactId>okhttps</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<groupId>com.dtflys.forest</groupId>
|
||||
<artifactId>forest-spring-boot-starter</artifactId>
|
||||
<version>1.5.26</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
@@ -5,7 +5,7 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.ejlchina.okhttps.OkHttps;
|
||||
import com.dtflys.forest.Forest;
|
||||
|
||||
import cn.dev33.satoken.config.SaSsoConfig;
|
||||
import cn.dev33.satoken.sso.SaSsoHandle;
|
||||
@@ -46,8 +46,8 @@ public class SsoClientController {
|
||||
private void configSso(SaSsoConfig sso) {
|
||||
// 配置Http请求处理器
|
||||
sso.setSendHttp(url -> {
|
||||
System.out.println("发起请求:" + url);
|
||||
return OkHttps.sync(url).get().getBody().toString();
|
||||
System.out.println("------ 发起请求:" + url);
|
||||
return Forest.get(url).executeAsString();
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -45,7 +45,9 @@ spring:
|
||||
# 连接池中的最小空闲连接
|
||||
min-idle: 0
|
||||
|
||||
|
||||
forest:
|
||||
# 关闭 forest 请求日志打印
|
||||
log-enabled: false
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user