eureka
tanghc 4 years ago
parent 0f5f659b48
commit 5af379160c
  1. 4
      changelog.md
  2. 65
      doc/docs/_sidebar.md
  3. 14
      doc/docs/files/10113_超时设置.md
  4. 2
      doc/pom.xml
  5. 4
      pom.xml
  6. 3
      sop-admin/pom.xml
  7. 4
      sop-admin/sop-admin-server/pom.xml
  8. 6
      sop-auth/pom.xml
  9. 2
      sop-common/pom.xml
  10. 6
      sop-common/sop-bridge-eureka/pom.xml
  11. 6
      sop-common/sop-bridge-nacos/pom.xml
  12. 3
      sop-common/sop-gateway-common/pom.xml
  13. 5
      sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/result/GatewayResultExecutor.java
  14. 2
      sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/message/ErrorEnum.java
  15. 7
      sop-common/sop-gateway-common/src/main/resources/i18n/open/error_en.properties
  16. 207
      sop-common/sop-gateway-common/src/main/resources/i18n/open/error_zh_CN.properties
  17. 4
      sop-common/sop-service-common/pom.xml
  18. 2
      sop-example/pom.xml
  19. 4
      sop-example/sop-springmvc/pom.xml
  20. 4
      sop-example/sop-story/pom.xml
  21. 29
      sop-example/sop-story/src/main/java/com/gitee/sop/storyweb/controller/Example1009_TimeoutController.java
  22. 4
      sop-gateway/pom.xml
  23. 13
      sop-gateway/src/main/resources/application-dev.properties
  24. 3
      sop-sdk/pom.xml
  25. 4
      sop-sdk/sdk-java/pom.xml
  26. 2
      sop-test/pom.xml
  27. 6
      sop-test/src/main/java/com/gitee/sop/test/HttpTool.java
  28. 65
      sop-test/src/test/java/com/gitee/sop/test/TimeoutTest.java
  29. 3
      sop-website/pom.xml
  30. 4
      sop-website/sop-website-server/pom.xml

@ -1,5 +1,9 @@
# changelog
## 4.2.6
- 优化网关超时处理
## 4.2.5
- 修复restful负载均衡问题

@ -1,34 +1,35 @@
* [首页](/?t=1606133657136)
* [首页](/?t=1613961608243)
* 开发文档
* [快速体验](files/10010_快速体验.md?t=1606133657138)
* [项目接入到SOP](files/10011_项目接入到SOP.md?t=1606133657161)
* [新增接口](files/10020_新增接口.md?t=1606133657161)
* [开发流程](files/10021_开发流程.md?t=1606133657161)
* [业务参数校验](files/10030_业务参数校验.md?t=1606133657161)
* [错误处理](files/10040_错误处理.md?t=1606133657161)
* [编写文档](files/10041_编写文档.md?t=1606133657162)
* [接口交互详解](files/10050_接口交互详解.md?t=1606133657162)
* [使用签名校验工具](files/10080_使用签名校验工具.md?t=1606133657162)
* [ISV管理](files/10085_ISV管理.md?t=1606133657162)
* [自定义返回结果](files/10087_自定义返回结果.md?t=1606133657162)
* [自定义过滤器](files/10088_自定义过滤器.md?t=1606133657162)
* [自定义校验token](files/10089_自定义校验token.md?t=1606133657162)
* [网关拦截器](files/10090_网关拦截器.md?t=1606133657163)
* [路由授权](files/10091_路由授权.md?t=1606133657163)
* [接口限流](files/10092_接口限流.md?t=1606133657163)
* [路由监控](files/10093_路由监控.md?t=1606133657163)
* [SDK开发](files/10095_SDK开发.md?t=1606133657163)
* [应用授权](files/10097_应用授权.md?t=1606133657163)
* [提供restful接口](files/10100_提供restful接口.md?t=1606133657163)
* [文件上传](files/10104_文件上传.md?t=1606133657163)
* [配置Sleuth链路追踪](files/10109_配置Sleuth链路追踪.md?t=1606133657164)
* [预发布灰度发布](files/10110_预发布灰度发布.md?t=1606133657164)
* [动态修改请求参数](files/10111_动态修改请求参数.md?t=1606133657164)
* [使用eureka](files/10112_使用eureka.md?t=1606133657164)
* [快速体验](files/10010_快速体验.md?t=1613961608246)
* [项目接入到SOP](files/10011_项目接入到SOP.md?t=1613961608270)
* [新增接口](files/10020_新增接口.md?t=1613961608270)
* [开发流程](files/10021_开发流程.md?t=1613961608270)
* [业务参数校验](files/10030_业务参数校验.md?t=1613961608270)
* [错误处理](files/10040_错误处理.md?t=1613961608271)
* [编写文档](files/10041_编写文档.md?t=1613961608271)
* [接口交互详解](files/10050_接口交互详解.md?t=1613961608271)
* [使用签名校验工具](files/10080_使用签名校验工具.md?t=1613961608271)
* [ISV管理](files/10085_ISV管理.md?t=1613961608271)
* [自定义返回结果](files/10087_自定义返回结果.md?t=1613961608271)
* [自定义过滤器](files/10088_自定义过滤器.md?t=1613961608271)
* [自定义校验token](files/10089_自定义校验token.md?t=1613961608271)
* [网关拦截器](files/10090_网关拦截器.md?t=1613961608271)
* [路由授权](files/10091_路由授权.md?t=1613961608272)
* [接口限流](files/10092_接口限流.md?t=1613961608272)
* [路由监控](files/10093_路由监控.md?t=1613961608272)
* [SDK开发](files/10095_SDK开发.md?t=1613961608272)
* [应用授权](files/10097_应用授权.md?t=1613961608272)
* [提供restful接口](files/10100_提供restful接口.md?t=1613961608272)
* [文件上传](files/10104_文件上传.md?t=1613961608272)
* [配置Sleuth链路追踪](files/10109_配置Sleuth链路追踪.md?t=1613961608273)
* [预发布灰度发布](files/10110_预发布灰度发布.md?t=1613961608273)
* [动态修改请求参数](files/10111_动态修改请求参数.md?t=1613961608273)
* [使用eureka](files/10112_使用eureka.md?t=1613961608273)
* [超时设置](files/10113_超时设置.md?t=1613961608273)
* 原理分析
* [网关性能测试](files/90001_网关性能测试.md?t=1606133657164)
* [原理分析之如何存储路由](files/90011_原理分析之如何存储路由.md?t=1606133657164)
* [原理分析之如何路由](files/90012_原理分析之如何路由.md?t=1606133657164)
* [原理分析之文档归纳](files/90013_原理分析之文档归纳.md?t=1606133657164)
* [原理分析之预发布灰度发布](files/90014_原理分析之预发布灰度发布.md?t=1606133657165)
* [常见问题](files/90100_常见问题.md?t=1606133657165)
* [网关性能测试](files/90001_网关性能测试.md?t=1613961608273)
* [原理分析之如何存储路由](files/90011_原理分析之如何存储路由.md?t=1613961608273)
* [原理分析之如何路由](files/90012_原理分析之如何路由.md?t=1613961608273)
* [原理分析之文档归纳](files/90013_原理分析之文档归纳.md?t=1613961608274)
* [原理分析之预发布灰度发布](files/90014_原理分析之预发布灰度发布.md?t=1613961608274)
* [常见问题](files/90100_常见问题.md?t=1613961608274)

@ -0,0 +1,14 @@
# 超时设置
当微服务处理业务逻辑时间过长,网关会报超时错误,默认等待时间是5秒。
可在网关指定`spring.cloud.gateway.httpclient.response-timeout`参数设置超时时间,单位毫秒
```properties
# 设置响应超时10秒
spring.cloud.gateway.httpclient.response-timeout=10000
```
更多配置参见:`org.springframework.cloud.gateway.config.HttpClientProperties`
测试用例参见:`com.gitee.sop.test.TimeoutTest`

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.gitee.sop</groupId>
<artifactId>doc</artifactId>
<version>4.2.5-SNAPSHOT</version>
<version>${revision}</version>
<properties>
<!-- Generic properties -->

@ -12,7 +12,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.5-SNAPSHOT</version>
<version>${revision}</version>
<packaging>pom</packaging>
<description>一个开放平台解决方案项目,基于Spring Cloud实现,目标是能够让用户快速得搭建起自己的开放平台</description>
@ -29,6 +29,8 @@
</modules>
<properties>
<!-- Project revision -->
<revision>4.2.6-SNAPSHOT</revision>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

@ -6,13 +6,12 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.5-SNAPSHOT</version>
<version>${revision}</version>
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>sop-admin</artifactId>
<version>4.2.5-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>

@ -5,13 +5,13 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.5-SNAPSHOT</version>
<version>${revision}</version>
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>sop-admin-server</artifactId>
<version>4.2.5-SNAPSHOT</version>
<version>${revision}</version>
<packaging>jar</packaging>
<properties>

@ -5,7 +5,7 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.5-SNAPSHOT</version>
<version>${revision}</version>
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
@ -25,7 +25,7 @@
<dependency>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-service-common</artifactId>
<version>4.2.5-SNAPSHOT</version>
<version>${project.version}</version>
</dependency>
<!-- sop相关配置 end-->
@ -38,7 +38,7 @@
<dependency>
<groupId>com.gitee.sop</groupId>
<artifactId>sdk-java</artifactId>
<version>4.2.5-SNAPSHOT</version>
<version>${revision}</version>
</dependency>
<!-- http请求 -->
<dependency>

@ -6,7 +6,7 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.5-SNAPSHOT</version>
<version>${revision}</version>
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>

@ -5,20 +5,18 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.5-SNAPSHOT</version>
<version>${revision}</version>
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
<modelVersion>4.0.0</modelVersion>
<version>4.2.5-SNAPSHOT</version>
<artifactId>sop-bridge-eureka</artifactId>
<dependencies>
<dependency>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-gateway-common</artifactId>
<version>4.2.5-SNAPSHOT</version>
<version>${project.version}</version>
</dependency>
<dependency>

@ -5,20 +5,18 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.5-SNAPSHOT</version>
<version>${revision}</version>
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
<modelVersion>4.0.0</modelVersion>
<version>4.2.5-SNAPSHOT</version>
<artifactId>sop-bridge-nacos</artifactId>
<dependencies>
<dependency>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-gateway-common</artifactId>
<version>4.2.5-SNAPSHOT</version>
<version>${project.version}</version>
</dependency>
<dependency>

@ -5,13 +5,12 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.5-SNAPSHOT</version>
<version>${revision}</version>
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>sop-gateway-common</artifactId>
<version>4.2.5-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>

@ -14,6 +14,7 @@ import com.gitee.sop.gatewaycommon.result.BaseExecutorAdapter;
import com.gitee.sop.gatewaycommon.result.ResultExecutorForGateway;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.gateway.support.TimeoutException;
import org.springframework.http.HttpStatus;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
@ -84,7 +85,9 @@ public class GatewayResultExecutor extends BaseExecutorAdapter<ServerWebExchange
public String buildErrorResult(ServerWebExchange exchange, Throwable ex) {
Locale locale = getLocale(exchange);
Error error;
if (ex instanceof ApiException) {
if (ex.getCause() instanceof TimeoutException) {
error = ErrorEnum.ISP_GATEWAY_RESPONSE_TIMEOUT.getErrorMeta().getError(locale);
} else if (ex instanceof ApiException) {
ApiException apiException = (ApiException) ex;
error = apiException.getError(locale);
} else {

@ -12,6 +12,8 @@ public enum ErrorEnum {
ISP_UNKNOWN_ERROR(Codes.CODE_UNKNOWN, "isp.unknown-error"),
/** 服务不可用,路由被禁用 */
ISP_API_DISABLED(Codes.CODE_UNKNOWN, "isp.service-not-available"),
/** 网关响应超时 */
ISP_GATEWAY_RESPONSE_TIMEOUT(Codes.CODE_UNKNOWN, "isp.gateway-response-timeout"),
/** 限流处理 */
ISV_REQUEST_LIMIT(Codes.CODE_UNKNOWN, "isv.service-busy"),

@ -1,13 +1,14 @@
# 网关错误配置
# \u7F51\u5173\u9519\u8BEF\u914D\u7F6E
open.error_10000=Success
# 格式:前缀 + 网关错误码 + "_"+ 子错误码
# open.error_(前缀)20000(网关错误码)_isp.unknow-error(子错误码)
# \u683C\u5F0F\uFF1A\u524D\u7F00 + \u7F51\u5173\u9519\u8BEF\u7801 + "_"+ \u5B50\u9519\u8BEF\u7801
# open.error_\uFF08\u524D\u7F00\uFF0920000\uFF08\u7F51\u5173\u9519\u8BEF\u7801\uFF09_isp.unknow-error\uFF08\u5B50\u9519\u8BEF\u7801\uFF09
open.error_20000=Service is temporarily unavailable
open.error_20000_isp.unknown-error=Service is temporarily unavailable
open.error_20000_aop.unknown-error=Service is temporarily unavailable
open.error_20000_isp.service-not-available=Service is temporarily unavailable
open.error_20000_isp.gateway-response-timeout=Gateway response timeout
open.error_20000_isv.service-busy=service busy
open.error_20001=Insufficient authorization authority

@ -1,118 +1,119 @@
# 网关错误配置
# \u7F51\u5173\u9519\u8BEF\u914D\u7F6E
#open.error_20000=服务不可用
#open.error_20000_isp.unknow-error=服务暂不可用
#open.error_20000_aop.unknow-error=服务暂不可用
#open.error_20000_isp.service-not-available=服务暂不可用
#open.error_20000=\u670D\u52A1\u4E0D\u53EF\u7528
#open.error_20000_isp.unknow-error=\u670D\u52A1\u6682\u4E0D\u53EF\u7528
#open.error_20000_aop.unknow-error=\u670D\u52A1\u6682\u4E0D\u53EF\u7528
#open.error_20000_isp.service-not-available=\u670D\u52A1\u6682\u4E0D\u53EF\u7528
#
#open.error_20001=授权权限不足
#open.error_20001_aop.invalid-auth-token=无效的访问令牌
#open.error_20001_aop.auth-token-time-out=访问令牌已过期
#open.error_20001_aop.invalid-app-auth-token=无效的应用授权令牌
#open.error_20001_aop.invalid-app-auth-token-no-api=商户未授权当前接口
#open.error_20001_aop.app-auth-token-time-out=应用授权令牌已过期
#open.error_20001_aop.no-product-reg-by-partner=商户未签约任何产品
#open.error_20001=\u6388\u6743\u6743\u9650\u4E0D\u8DB3
#open.error_20001_aop.invalid-auth-token=\u65E0\u6548\u7684\u8BBF\u95EE\u4EE4\u724C
#open.error_20001_aop.auth-token-time-out=\u8BBF\u95EE\u4EE4\u724C\u5DF2\u8FC7\u671F
#open.error_20001_aop.invalid-app-auth-token=\u65E0\u6548\u7684\u5E94\u7528\u6388\u6743\u4EE4\u724C
#open.error_20001_aop.invalid-app-auth-token-no-api=\u5546\u6237\u672A\u6388\u6743\u5F53\u524D\u63A5\u53E3
#open.error_20001_aop.app-auth-token-time-out=\u5E94\u7528\u6388\u6743\u4EE4\u724C\u5DF2\u8FC7\u671F
#open.error_20001_aop.no-product-reg-by-partner=\u5546\u6237\u672A\u7B7E\u7EA6\u4EFB\u4F55\u4EA7\u54C1
#
#open.error_40001=缺少必选参数
#open.error_40001_isv.missing-method=缺少方法名参数
#open.error_40001_isv.missing-signature=缺少签名参数
#open.error_40001_isv.missing-signature-type=缺少签名类型参数
#open.error_40001_isv.missing-signature-key=缺少签名配置
#open.error_40001_isv.missing-app-id=缺少appId参数
#open.error_40001_isv.missing-timestamp=缺少时间戳参数
#open.error_40001_isv.missing-version=缺少版本参数
#open.error_40001_isv.decryption-error-missing-encrypt-type=解密出错, 未指定加密算法
#open.error_40001=\u7F3A\u5C11\u5FC5\u9009\u53C2\u6570
#open.error_40001_isv.missing-method=\u7F3A\u5C11\u65B9\u6CD5\u540D\u53C2\u6570
#open.error_40001_isv.missing-signature=\u7F3A\u5C11\u7B7E\u540D\u53C2\u6570
#open.error_40001_isv.missing-signature-type=\u7F3A\u5C11\u7B7E\u540D\u7C7B\u578B\u53C2\u6570
#open.error_40001_isv.missing-signature-key=\u7F3A\u5C11\u7B7E\u540D\u914D\u7F6E
#open.error_40001_isv.missing-app-id=\u7F3A\u5C11appId\u53C2\u6570
#open.error_40001_isv.missing-timestamp=\u7F3A\u5C11\u65F6\u95F4\u6233\u53C2\u6570
#open.error_40001_isv.missing-version=\u7F3A\u5C11\u7248\u672C\u53C2\u6570
#open.error_40001_isv.decryption-error-missing-encrypt-type=\u89E3\u5BC6\u51FA\u9519, \u672A\u6307\u5B9A\u52A0\u5BC6\u7B97\u6CD5
#
#open.error_40002=非法的参数
#open.error_40002_isv.invalid-parameter=参数无效
#open.error_40002_isv.upload-fail=文件上传失败
#open.error_40002_isv.invalid-file-extension=文件扩展名无效
#open.error_40002_isv.invalid-file-size={0}文件大小无效,单文件不得超过{1}
#open.error_40002_isv.invalid-method=不存在的方法名
#open.error_40002_isv.invalid-format=无效的数据格式
#open.error_40002_isv.invalid-signature-type=无效的签名类型
#open.error_40002_isv.invalid-signature=无效签名
#open.error_40002_isv.invalid-encrypt-type=无效的加密类型
#open.error_40002_isv.invalid-encrypt=解密异常
#open.error_40002_isv.invalid-app-id=无效的appId参数
#open.error_40002_isv.invalid-timestamp=非法的时间戳参数
#open.error_40002_isv.invalid-charset=字符集错误
#open.error_40002_isv.invalid-digest=摘要错误
#open.error_40002_isv.decryption-error-not-valid-encrypt-type=解密出错,不支持的加密算法
#open.error_40002_isv.decryption-error-not-valid-encrypt-key=解密出错, 未配置加密密钥或加密密钥格式错误
#open.error_40002_isv.decryption-error-unknown=解密出错,未知异常
#open.error_40002_isv.missing-signature-config=验签出错, 未配置对应签名算法的公钥或者证书
#open.error_40002_isv.not-support-app-auth=本接口不支持第三方代理调用
#open.error_40002_isv.suspected-attack=可疑的攻击请求
#open.error_40002_isv.invalid-content-type=无效的content-type
#open.error_40002=\u975E\u6CD5\u7684\u53C2\u6570
#open.error_40002_isv.invalid-parameter=\u53C2\u6570\u65E0\u6548
#open.error_40002_isv.upload-fail=\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25
#open.error_40002_isv.invalid-file-extension=\u6587\u4EF6\u6269\u5C55\u540D\u65E0\u6548
#open.error_40002_isv.invalid-file-size={0}\u6587\u4EF6\u5927\u5C0F\u65E0\u6548\uFF0C\u5355\u6587\u4EF6\u4E0D\u5F97\u8D85\u8FC7{1}
#open.error_40002_isv.invalid-method=\u4E0D\u5B58\u5728\u7684\u65B9\u6CD5\u540D
#open.error_40002_isv.invalid-format=\u65E0\u6548\u7684\u6570\u636E\u683C\u5F0F
#open.error_40002_isv.invalid-signature-type=\u65E0\u6548\u7684\u7B7E\u540D\u7C7B\u578B
#open.error_40002_isv.invalid-signature=\u65E0\u6548\u7B7E\u540D
#open.error_40002_isv.invalid-encrypt-type=\u65E0\u6548\u7684\u52A0\u5BC6\u7C7B\u578B
#open.error_40002_isv.invalid-encrypt=\u89E3\u5BC6\u5F02\u5E38
#open.error_40002_isv.invalid-app-id=\u65E0\u6548\u7684appId\u53C2\u6570
#open.error_40002_isv.invalid-timestamp=\u975E\u6CD5\u7684\u65F6\u95F4\u6233\u53C2\u6570
#open.error_40002_isv.invalid-charset=\u5B57\u7B26\u96C6\u9519\u8BEF
#open.error_40002_isv.invalid-digest=\u6458\u8981\u9519\u8BEF
#open.error_40002_isv.decryption-error-not-valid-encrypt-type=\u89E3\u5BC6\u51FA\u9519\uFF0C\u4E0D\u652F\u6301\u7684\u52A0\u5BC6\u7B97\u6CD5
#open.error_40002_isv.decryption-error-not-valid-encrypt-key=\u89E3\u5BC6\u51FA\u9519, \u672A\u914D\u7F6E\u52A0\u5BC6\u5BC6\u94A5\u6216\u52A0\u5BC6\u5BC6\u94A5\u683C\u5F0F\u9519\u8BEF
#open.error_40002_isv.decryption-error-unknown=\u89E3\u5BC6\u51FA\u9519\uFF0C\u672A\u77E5\u5F02\u5E38
#open.error_40002_isv.missing-signature-config=\u9A8C\u7B7E\u51FA\u9519, \u672A\u914D\u7F6E\u5BF9\u5E94\u7B7E\u540D\u7B97\u6CD5\u7684\u516C\u94A5\u6216\u8005\u8BC1\u4E66
#open.error_40002_isv.not-support-app-auth=\u672C\u63A5\u53E3\u4E0D\u652F\u6301\u7B2C\u4E09\u65B9\u4EE3\u7406\u8C03\u7528
#open.error_40002_isv.suspected-attack=\u53EF\u7591\u7684\u653B\u51FB\u8BF7\u6C42
#open.error_40002_isv.invalid-content-type=\u65E0\u6548\u7684content-type
#
#open.error_40004=业务处理失败
#open.error_40004_=业务处理失败
#open.error_40004=\u4E1A\u52A1\u5904\u7406\u5931\u8D25
#open.error_40004_=\u4E1A\u52A1\u5904\u7406\u5931\u8D25
#
#open.error_40006=权限不足
#open.error_40006_isv.insufficient-isv-permissions=请检查配置的账户是否有当前接口权限
#open.error_40006_isv.insufficient-user-permissions=代理的商户没有当前接口权限
#open.error_40006_isv.route-no-permissions=没有当前接口权限
#open.error_40006_isv.access-forbidden=无权访问
#open.error_40006=\u6743\u9650\u4E0D\u8DB3
#open.error_40006_isv.insufficient-isv-permissions=\u8BF7\u68C0\u67E5\u914D\u7F6E\u7684\u8D26\u6237\u662F\u5426\u6709\u5F53\u524D\u63A5\u53E3\u6743\u9650
#open.error_40006_isv.insufficient-user-permissions=\u4EE3\u7406\u7684\u5546\u6237\u6CA1\u6709\u5F53\u524D\u63A5\u53E3\u6743\u9650
#open.error_40006_isv.route-no-permissions=\u6CA1\u6709\u5F53\u524D\u63A5\u53E3\u6743\u9650
#open.error_40006_isv.access-forbidden=\u65E0\u6743\u8BBF\u95EE
open.error_10000=Success
# 格式:前缀 + 网关错误码 + "_"+ 子错误码
# open.error_(前缀)20000(网关错误码)_isp.unknow-error(子错误码)
open.error_20000=\u670d\u52a1\u4e0d\u53ef\u7528
open.error_20000_isp.unknown-error=\u670d\u52a1\u6682\u4e0d\u53ef\u7528
open.error_20000_aop.unknown-error=\u670d\u52a1\u6682\u4e0d\u53ef\u7528
open.error_20000_isp.service-not-available=\u670d\u52a1\u6682\u4e0d\u53ef\u7528
open.error_20000_isv.service-busy=\u670d\u52a1\u5668\u5fd9
# \u683C\u5F0F\uFF1A\u524D\u7F00 + \u7F51\u5173\u9519\u8BEF\u7801 + "_"+ \u5B50\u9519\u8BEF\u7801
# open.error_\uFF08\u524D\u7F00\uFF0920000\uFF08\u7F51\u5173\u9519\u8BEF\u7801\uFF09_isp.unknow-error\uFF08\u5B50\u9519\u8BEF\u7801\uFF09
open.error_20000=\u670D\u52A1\u4E0D\u53EF\u7528
open.error_20000_isp.unknown-error=\u670D\u52A1\u6682\u4E0D\u53EF\u7528
open.error_20000_aop.unknown-error=\u670D\u52A1\u6682\u4E0D\u53EF\u7528
open.error_20000_isp.service-not-available=\u670D\u52A1\u6682\u4E0D\u53EF\u7528
open.error_20000_isp.gateway-response-timeout=\u7F51\u5173\u54CD\u5E94\u8D85\u65F6
open.error_20000_isv.service-busy=\u670D\u52A1\u5668\u5FD9
open.error_20001=\u6388\u6743\u6743\u9650\u4e0d\u8db3
open.error_20001_aop.invalid-auth-token=\u65e0\u6548\u7684\u8bbf\u95ee\u4ee4\u724c
open.error_20001_aop.auth-token-time-out=\u8bbf\u95ee\u4ee4\u724c\u5df2\u8fc7\u671f
open.error_20001_aop.invalid-app-auth-token=\u65e0\u6548\u7684\u5e94\u7528\u6388\u6743\u4ee4\u724c
open.error_20001_aop.invalid-app-auth-token-no-api=\u5546\u6237\u672a\u6388\u6743\u5f53\u524d\u63a5\u53e3
open.error_20001_aop.app-auth-token-time-out=\u5e94\u7528\u6388\u6743\u4ee4\u724c\u5df2\u8fc7\u671f
open.error_20001_aop.no-product-reg-by-partner=\u5546\u6237\u672a\u7b7e\u7ea6\u4efb\u4f55\u4ea7\u54c1
open.error_20001=\u6388\u6743\u6743\u9650\u4E0D\u8DB3
open.error_20001_aop.invalid-auth-token=\u65E0\u6548\u7684\u8BBF\u95EE\u4EE4\u724C
open.error_20001_aop.auth-token-time-out=\u8BBF\u95EE\u4EE4\u724C\u5DF2\u8FC7\u671F
open.error_20001_aop.invalid-app-auth-token=\u65E0\u6548\u7684\u5E94\u7528\u6388\u6743\u4EE4\u724C
open.error_20001_aop.invalid-app-auth-token-no-api=\u5546\u6237\u672A\u6388\u6743\u5F53\u524D\u63A5\u53E3
open.error_20001_aop.app-auth-token-time-out=\u5E94\u7528\u6388\u6743\u4EE4\u724C\u5DF2\u8FC7\u671F
open.error_20001_aop.no-product-reg-by-partner=\u5546\u6237\u672A\u7B7E\u7EA6\u4EFB\u4F55\u4EA7\u54C1
open.error_40001=\u7f3a\u5c11\u5fc5\u9009\u53c2\u6570
open.error_40001_isv.missing-method=\u7f3a\u5c11\u65b9\u6cd5\u540d\u53c2\u6570
open.error_40001_isv.missing-signature=\u7f3a\u5c11\u7b7e\u540d\u53c2\u6570
open.error_40001_isv.missing-signature-type=\u7f3a\u5c11\u7b7e\u540d\u7c7b\u578b\u53c2\u6570
open.error_40001_isv.missing-signature-key=\u7f3a\u5c11\u7b7e\u540d\u914d\u7f6e
open.error_40001_isv.missing-app-id=\u7f3a\u5c11appId\u53c2\u6570
open.error_40001_isv.missing-timestamp=\u7f3a\u5c11\u65f6\u95f4\u6233\u53c2\u6570
open.error_40001_isv.missing-version=\u7f3a\u5c11\u7248\u672c\u53c2\u6570
open.error_40001_isv.decryption-error-missing-encrypt-type=\u89e3\u5bc6\u51fa\u9519, \u672a\u6307\u5b9a\u52a0\u5bc6\u7b97\u6cd5
open.error_40001=\u7F3A\u5C11\u5FC5\u9009\u53C2\u6570
open.error_40001_isv.missing-method=\u7F3A\u5C11\u65B9\u6CD5\u540D\u53C2\u6570
open.error_40001_isv.missing-signature=\u7F3A\u5C11\u7B7E\u540D\u53C2\u6570
open.error_40001_isv.missing-signature-type=\u7F3A\u5C11\u7B7E\u540D\u7C7B\u578B\u53C2\u6570
open.error_40001_isv.missing-signature-key=\u7F3A\u5C11\u7B7E\u540D\u914D\u7F6E
open.error_40001_isv.missing-app-id=\u7F3A\u5C11appId\u53C2\u6570
open.error_40001_isv.missing-timestamp=\u7F3A\u5C11\u65F6\u95F4\u6233\u53C2\u6570
open.error_40001_isv.missing-version=\u7F3A\u5C11\u7248\u672C\u53C2\u6570
open.error_40001_isv.decryption-error-missing-encrypt-type=\u89E3\u5BC6\u51FA\u9519, \u672A\u6307\u5B9A\u52A0\u5BC6\u7B97\u6CD5
open.error_40002=\u975e\u6cd5\u7684\u53c2\u6570
open.error_40002_isv.invalid-parameter=\u53c2\u6570\u65e0\u6548
open.error_40002_isv.upload-fail=\u6587\u4ef6\u4e0a\u4f20\u5931\u8d25
open.error_40002_isv.invalid-file-extension=\u6587\u4ef6\u6269\u5c55\u540d\u65e0\u6548
open.error_40002_isv.invalid-file-size={0}\u6587\u4ef6\u5927\u5c0f\u65e0\u6548\uff0c\u5355\u6587\u4ef6\u4e0d\u5f97\u8d85\u8fc7{1}
open.error_40002_isv.invalid-method=\u4e0d\u5b58\u5728\u7684\u65b9\u6cd5\u540d
open.error_40002_isv.invalid-format=\u65e0\u6548\u7684\u6570\u636e\u683c\u5f0f
open.error_40002_isv.invalid-signature-type=\u65e0\u6548\u7684\u7b7e\u540d\u7c7b\u578b
open.error_40002_isv.invalid-signature=\u65e0\u6548\u7b7e\u540d
open.error_40002_isv.invalid-encrypt-type=\u65e0\u6548\u7684\u52a0\u5bc6\u7c7b\u578b
open.error_40002_isv.invalid-encrypt=\u89e3\u5bc6\u5f02\u5e38
open.error_40002_isv.invalid-app-id=\u65e0\u6548\u7684appId\u53c2\u6570
open.error_40002_isv.invalid-timestamp=\u975e\u6cd5\u7684\u65f6\u95f4\u6233\u53c2\u6570
open.error_40002_isv.invalid-charset=\u5b57\u7b26\u96c6\u9519\u8bef
open.error_40002_isv.invalid-digest=\u6458\u8981\u9519\u8bef
open.error_40002_isv.decryption-error-not-valid-encrypt-type=\u89e3\u5bc6\u51fa\u9519\uff0c\u4e0d\u652f\u6301\u7684\u52a0\u5bc6\u7b97\u6cd5
open.error_40002_isv.decryption-error-not-valid-encrypt-key=\u89e3\u5bc6\u51fa\u9519, \u672a\u914d\u7f6e\u52a0\u5bc6\u5bc6\u94a5\u6216\u52a0\u5bc6\u5bc6\u94a5\u683c\u5f0f\u9519\u8bef
open.error_40002_isv.decryption-error-unknown=\u89e3\u5bc6\u51fa\u9519\uff0c\u672a\u77e5\u5f02\u5e38
open.error_40002_isv.missing-signature-config=\u9a8c\u7b7e\u51fa\u9519, \u672a\u914d\u7f6e\u5bf9\u5e94\u7b7e\u540d\u7b97\u6cd5\u7684\u516c\u94a5\u6216\u8005\u8bc1\u4e66
open.error_40002_isv.not-support-app-auth=\u672c\u63a5\u53e3\u4e0d\u652f\u6301\u7b2c\u4e09\u65b9\u4ee3\u7406\u8c03\u7528
open.error_40002_isv.suspected-attack=\u53ef\u7591\u7684\u653b\u51fb\u8bf7\u6c42
open.error_40002_isv.invalid-content-type=\u65e0\u6548\u7684content-type
open.error_40002=\u975E\u6CD5\u7684\u53C2\u6570
open.error_40002_isv.invalid-parameter=\u53C2\u6570\u65E0\u6548
open.error_40002_isv.upload-fail=\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25
open.error_40002_isv.invalid-file-extension=\u6587\u4EF6\u6269\u5C55\u540D\u65E0\u6548
open.error_40002_isv.invalid-file-size={0}\u6587\u4EF6\u5927\u5C0F\u65E0\u6548\uFF0C\u5355\u6587\u4EF6\u4E0D\u5F97\u8D85\u8FC7{1}
open.error_40002_isv.invalid-method=\u4E0D\u5B58\u5728\u7684\u65B9\u6CD5\u540D
open.error_40002_isv.invalid-format=\u65E0\u6548\u7684\u6570\u636E\u683C\u5F0F
open.error_40002_isv.invalid-signature-type=\u65E0\u6548\u7684\u7B7E\u540D\u7C7B\u578B
open.error_40002_isv.invalid-signature=\u65E0\u6548\u7B7E\u540D
open.error_40002_isv.invalid-encrypt-type=\u65E0\u6548\u7684\u52A0\u5BC6\u7C7B\u578B
open.error_40002_isv.invalid-encrypt=\u89E3\u5BC6\u5F02\u5E38
open.error_40002_isv.invalid-app-id=\u65E0\u6548\u7684appId\u53C2\u6570
open.error_40002_isv.invalid-timestamp=\u975E\u6CD5\u7684\u65F6\u95F4\u6233\u53C2\u6570
open.error_40002_isv.invalid-charset=\u5B57\u7B26\u96C6\u9519\u8BEF
open.error_40002_isv.invalid-digest=\u6458\u8981\u9519\u8BEF
open.error_40002_isv.decryption-error-not-valid-encrypt-type=\u89E3\u5BC6\u51FA\u9519\uFF0C\u4E0D\u652F\u6301\u7684\u52A0\u5BC6\u7B97\u6CD5
open.error_40002_isv.decryption-error-not-valid-encrypt-key=\u89E3\u5BC6\u51FA\u9519, \u672A\u914D\u7F6E\u52A0\u5BC6\u5BC6\u94A5\u6216\u52A0\u5BC6\u5BC6\u94A5\u683C\u5F0F\u9519\u8BEF
open.error_40002_isv.decryption-error-unknown=\u89E3\u5BC6\u51FA\u9519\uFF0C\u672A\u77E5\u5F02\u5E38
open.error_40002_isv.missing-signature-config=\u9A8C\u7B7E\u51FA\u9519, \u672A\u914D\u7F6E\u5BF9\u5E94\u7B7E\u540D\u7B97\u6CD5\u7684\u516C\u94A5\u6216\u8005\u8BC1\u4E66
open.error_40002_isv.not-support-app-auth=\u672C\u63A5\u53E3\u4E0D\u652F\u6301\u7B2C\u4E09\u65B9\u4EE3\u7406\u8C03\u7528
open.error_40002_isv.suspected-attack=\u53EF\u7591\u7684\u653B\u51FB\u8BF7\u6C42
open.error_40002_isv.invalid-content-type=\u65E0\u6548\u7684content-type
open.error_40004=\u4e1a\u52a1\u5904\u7406\u5931\u8d25
open.error_40004_=\u4e1a\u52a1\u5904\u7406\u5931\u8d25
open.error_40004=\u4E1A\u52A1\u5904\u7406\u5931\u8D25
open.error_40004_=\u4E1A\u52A1\u5904\u7406\u5931\u8D25
open.error_40006=\u6743\u9650\u4e0d\u8db3
open.error_40006_isv.insufficient-isv-permissions=\u8bf7\u68c0\u67e5\u914d\u7f6e\u7684\u8d26\u6237\u662f\u5426\u6709\u5f53\u524d\u63a5\u53e3\u6743\u9650
open.error_40006_isv.insufficient-user-permissions=\u4ee3\u7406\u7684\u5546\u6237\u6ca1\u6709\u5f53\u524d\u63a5\u53e3\u6743\u9650
open.error_40006_isv.route-no-permissions=\u6ca1\u6709\u5f53\u524d\u63a5\u53e3\u6743\u9650
open.error_40006_isv.access-forbidden=\u65e0\u6743\u8bbf\u95ee
open.error_40006_isv.ip-forbidden=IP\u65e0\u6743\u8bbf\u95ee
open.error_40006=\u6743\u9650\u4E0D\u8DB3
open.error_40006_isv.insufficient-isv-permissions=\u8BF7\u68C0\u67E5\u914D\u7F6E\u7684\u8D26\u6237\u662F\u5426\u6709\u5F53\u524D\u63A5\u53E3\u6743\u9650
open.error_40006_isv.insufficient-user-permissions=\u4EE3\u7406\u7684\u5546\u6237\u6CA1\u6709\u5F53\u524D\u63A5\u53E3\u6743\u9650
open.error_40006_isv.route-no-permissions=\u6CA1\u6709\u5F53\u524D\u63A5\u53E3\u6743\u9650
open.error_40006_isv.access-forbidden=\u65E0\u6743\u8BBF\u95EE
open.error_40006_isv.ip-forbidden=IP\u65E0\u6743\u8BBF\u95EE

@ -6,13 +6,13 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.5-SNAPSHOT</version>
<version>${revision}</version>
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>sop-service-common</artifactId>
<version>4.2.5-SNAPSHOT</version>
<version>${revision}</version>
<packaging>jar</packaging>
<properties>

@ -5,7 +5,7 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.5-SNAPSHOT</version>
<version>${revision}</version>
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>

@ -5,7 +5,7 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.5-SNAPSHOT</version>
<version>${revision}</version>
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
@ -26,7 +26,7 @@
<dependency>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-service-common</artifactId>
<version>4.2.5-SNAPSHOT</version>
<version>${project.version}</version>
</dependency>
<!-- nacos -->
<dependency>

@ -4,7 +4,7 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.5-SNAPSHOT</version>
<version>${revision}</version>
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
@ -19,7 +19,7 @@
<dependency>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-service-common</artifactId>
<version>4.2.5-SNAPSHOT</version>
<version>${project.version}</version>
</dependency>
<dependency>

@ -0,0 +1,29 @@
package com.gitee.sop.storyweb.controller;
import com.gitee.sop.servercommon.annotation.Open;
import com.gitee.sop.storyweb.controller.param.StoryParam;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.concurrent.TimeUnit;
/**
* 模拟超时设置
*
* @author tanghc
*/
@RestController
public class Example1009_TimeoutController {
@Open("goods.timeout")
@RequestMapping("timeoutTest")
public Object timeout(StoryParam param) {
// 模拟耗时操作,耗时10秒
try {
TimeUnit.SECONDS.sleep(10);
} catch (InterruptedException e) {
e.printStackTrace();
}
return param;
}
}

@ -4,7 +4,7 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.5-SNAPSHOT</version>
<version>${revision}</version>
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
@ -24,7 +24,7 @@
<groupId>com.gitee.sop</groupId>
<artifactId>sop-bridge-nacos</artifactId>
<!-- <artifactId>sop-bridge-eureka</artifactId>-->
<version>4.2.5-SNAPSHOT</version>
<version>${project.version}</version>
</dependency>
<dependency>

@ -1,15 +1,18 @@
# 更多配置,见:META-INF/gateway.properties
# \u66F4\u591A\u914D\u7F6E\uFF0C\u89C1\uFF1AMETA-INF/gateway.properties
server.port=8081
# mysql数据库配置
# mysql\u6570\u636E\u5E93\u914D\u7F6E
mysql.host=localhost:3306
mysql.username=root
mysql.password=root
# nacos注册中心地址
# nacos\u6CE8\u518C\u4E2D\u5FC3\u5730\u5740
register.url=127.0.0.1:8848
# 上传文件最大容量,默认10MB
# \u4E0A\u4F20\u6587\u4EF6\u6700\u5927\u5BB9\u91CF\uFF0C\u9ED8\u8BA410MB
spring.servlet.multipart.max-file-size=10MB
logging.level.com.gitee=debug
# \u54CD\u5E94\u8D85\u65F6\uFF0C\u9ED8\u8BA45\u79D2\uFF085000\uFF09
#spring.cloud.gateway.httpclient.response-timeout=5000
logging.level.com.gitee=debug

@ -6,13 +6,12 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.5-SNAPSHOT</version>
<version>${revision}</version>
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>sop-sdk</artifactId>
<version>4.2.5-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>

@ -4,13 +4,13 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.5-SNAPSHOT</version>
<version>${revision}</version>
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>sdk-java</artifactId>
<version>4.2.5-SNAPSHOT</version>
<version>${revision}</version>
<properties>
<!-- Generic properties -->

@ -5,7 +5,7 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.5-SNAPSHOT</version>
<version>${revision}</version>
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>

@ -75,15 +75,15 @@ public class HttpTool {
/**
* 请求超时时间
*/
private int connectTimeoutSeconds = 10;
private int connectTimeoutSeconds = 60;
/**
* http读取超时时间
*/
private int readTimeoutSeconds = 10;
private int readTimeoutSeconds = 60;
/**
* http写超时时间
*/
private int writeTimeoutSeconds = 10;
private int writeTimeoutSeconds = 60;
}
/**

@ -0,0 +1,65 @@
package com.gitee.sop.test;
import com.alibaba.fastjson.JSON;
import com.gitee.sop.test.alipay.AlipaySignature;
import org.junit.Test;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* 超时测试
*/
public class TimeoutTest extends TestBase {
String url = "http://localhost:8081";
String appId = "2019032617262200001";
// 平台提供的私钥
String privateKey = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCXJv1pQFqWNA/++OYEV7WYXwexZK/J8LY1OWlP9X0T6wHFOvxNKRvMkJ5544SbgsJpVcvRDPrcxmhPbi/sAhdO4x2PiPKIz9Yni2OtYCCeaiE056B+e1O2jXoLeXbfi9fPivJZkxH/tb4xfLkH3bA8ZAQnQsoXA0SguykMRZntF0TndUfvDrLqwhlR8r5iRdZLB6F8o8qXH6UPDfNEnf/K8wX5T4EB1b8x8QJ7Ua4GcIUqeUxGHdQpzNbJdaQvoi06lgccmL+PHzminkFYON7alj1CjDN833j7QMHdPtS9l7B67fOU/p2LAAkPMtoVBfxQt9aFj7B8rEhGCz02iJIBAgMBAAECggEARqOuIpY0v6WtJBfmR3lGIOOokLrhfJrGTLF8CiZMQha+SRJ7/wOLPlsH9SbjPlopyViTXCuYwbzn2tdABigkBHYXxpDV6CJZjzmRZ+FY3S/0POlTFElGojYUJ3CooWiVfyUMhdg5vSuOq0oCny53woFrf32zPHYGiKdvU5Djku1onbDU0Lw8w+5tguuEZ76kZ/lUcccGy5978FFmYpzY/65RHCpvLiLqYyWTtaNT1aQ/9pw4jX9HO9NfdJ9gYFK8r/2f36ZE4hxluAfeOXQfRC/WhPmiw/ReUhxPznG/WgKaa/OaRtAx3inbQ+JuCND7uuKeRe4osP2jLPHPP6AUwQKBgQDUNu3BkLoKaimjGOjCTAwtp71g1oo+k5/uEInAo7lyEwpV0EuUMwLA/HCqUgR4K9pyYV+Oyb8d6f0+Hz0BMD92I2pqlXrD7xV2WzDvyXM3s63NvorRooKcyfd9i6ccMjAyTR2qfLkxv0hlbBbsPHz4BbU63xhTJp3Ghi0/ey/1HQKBgQC2VsgqC6ykfSidZUNLmQZe3J0p/Qf9VLkfrQ+xaHapOs6AzDU2H2osuysqXTLJHsGfrwVaTs00ER2z8ljTJPBUtNtOLrwNRlvgdnzyVAKHfOgDBGwJgiwpeE9voB1oAV/mXqSaUWNnuwlOIhvQEBwekqNyWvhLqC7nCAIhj3yvNQKBgQCqYbeec56LAhWP903Zwcj9VvG7sESqXUhIkUqoOkuIBTWFFIm54QLTA1tJxDQGb98heoCIWf5x/A3xNI98RsqNBX5JON6qNWjb7/dobitti3t99v/ptDp9u8JTMC7penoryLKK0Ty3bkan95Kn9SC42YxaSghzqkt+uvfVQgiNGQKBgGxU6P2aDAt6VNwWosHSe+d2WWXt8IZBhO9d6dn0f7ORvcjmCqNKTNGgrkewMZEuVcliueJquR47IROdY8qmwqcBAN7Vg2K7r7CPlTKAWTRYMJxCT1Hi5gwJb+CZF3+IeYqsJk2NF2s0w5WJTE70k1BSvQsfIzAIDz2yE1oPHvwVAoGAA6e+xQkVH4fMEph55RJIZ5goI4Y76BSvt2N5OKZKd4HtaV+eIhM3SDsVYRLIm9ZquJHMiZQGyUGnsvrKL6AAVNK7eQZCRDk9KQz+0GKOGqku0nOZjUbAu6A2/vtXAaAuFSFx1rUQVVjFulLexkXR3KcztL1Qu2k5pB6Si0K/uwQ=";
// sop-gateway/src/main/resources/application-dev.properties中配置参数:
// spring.cloud.gateway.httpclient.response-timeout=11000
// 响应超时11秒
// 业务逻辑处理10秒,见:com.gitee.sop.storyweb.controller.Example1009_TimeoutController
// 把spring.cloud.gateway.httpclient.response-timeout值改成5000网关会报错
@Test
public void testGet() throws Exception {
// 公共请求参数
Map<String, String> params = new HashMap<String, String>();
params.put("app_id", appId);
params.put("method", "goods.timeout");
params.put("format", "json");
params.put("charset", "utf-8");
params.put("sign_type", "RSA2");
params.put("timestamp", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
params.put("version", "1.0");
// 业务参数
Map<String, Object> bizContent = new HashMap<>();
bizContent.put("id", "1");
bizContent.put("name", "葫芦娃");
params.put("biz_content", JSON.toJSONString(bizContent));
String content = AlipaySignature.getSignContent(params);
String sign = AlipaySignature.rsa256Sign(content, privateKey, "utf-8");
params.put("sign", sign);
System.out.println("----------- 请求信息 -----------");
System.out.println("请求参数:" + buildParamQuery(params));
System.out.println("商户秘钥:" + privateKey);
System.out.println("待签名内容:" + content);
System.out.println("签名(sign):" + sign);
System.out.println("URL参数:" + buildUrlQuery(params));
System.out.println("----------- 返回结果 -----------");
long start = System.currentTimeMillis();
String responseData = get(url, params);// 发送请求
System.out.printf("耗时:%s秒%n", (System.currentTimeMillis() - start) / 1000.0);
System.out.println(responseData);
}
}

@ -6,13 +6,12 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId>
<version>4.2.5-SNAPSHOT</version>
<version>${revision}</version>
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>sop-website</artifactId>
<version>4.2.5-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>

@ -5,7 +5,7 @@
<parent>
<groupId>com.gitee.sop</groupId>
<artifactId>sop-website</artifactId>
<version>4.2.5-SNAPSHOT</version>
<version>${revision}</version>
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>
@ -25,7 +25,7 @@
<groupId>com.gitee.sop</groupId>
<artifactId>sop-bridge-nacos</artifactId>
<!--<artifactId>sop-bridge-eureka</artifactId>-->
<version>4.2.5-SNAPSHOT</version>
<version>${project.version}</version>
</dependency>
<dependency>

Loading…
Cancel
Save