diff --git a/changelog.md b/changelog.md index be395966..be8c2fbf 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # changelog +## 2.3.0 + +- 支持请求restful接口(设置`sop.restful.enable=true`) + ## 2.2.0(需要执行`sop-2.2.0.sql`升级文件) - 支持eureka注册中心,见`eureka`分支 diff --git a/doc/docs/_sidebar.md b/doc/docs/_sidebar.md index b6441c02..963a464c 100644 --- a/doc/docs/_sidebar.md +++ b/doc/docs/_sidebar.md @@ -1,34 +1,34 @@ -* [首页](/?t=1570520682411) +* [首页](/?t=1570521912278) * 开发文档 - * [快速体验](files/10010_快速体验.md?t=1570520682413) - * [项目接入到SOP](files/10011_项目接入到SOP.md?t=1570520682439) - * [新增接口](files/10020_新增接口.md?t=1570520682440) - * [开发流程](files/10021_开发流程.md?t=1570520682440) - * [业务参数校验](files/10030_业务参数校验.md?t=1570520682440) - * [错误处理](files/10040_错误处理.md?t=1570520682440) - * [编写文档](files/10041_编写文档.md?t=1570520682440) - * [接口交互详解](files/10050_接口交互详解.md?t=1570520682440) - * [easyopen支持](files/10070_easyopen支持.md?t=1570520682440) - * [使用签名校验工具](files/10080_使用签名校验工具.md?t=1570520682440) - * [ISV管理](files/10085_ISV管理.md?t=1570520682441) - * [自定义返回结果](files/10087_自定义返回结果.md?t=1570520682441) - * [自定义过滤器](files/10088_自定义过滤器.md?t=1570520682441) - * [路由授权](files/10090_路由授权.md?t=1570520682441) - * [接口限流](files/10092_接口限流.md?t=1570520682441) - * [监控日志](files/10093_监控日志.md?t=1570520682441) - * [SDK开发](files/10095_SDK开发.md?t=1570520682441) - * [使用SpringCloudGateway](files/10096_使用SpringCloudGateway.md?t=1570520682441) - * [应用授权](files/10097_应用授权.md?t=1570520682442) - * [传统web开发](files/10100_传统web开发.md?t=1570520682442) - * [文件上传](files/10104_文件上传.md?t=1570520682442) - * [配置Sleuth链路追踪](files/10109_配置Sleuth链路追踪.md?t=1570520682442) - * [预发布灰度发布](files/10110_预发布灰度发布.md?t=1570520682442) - * [动态修改请求参数](files/10111_动态修改请求参数.md?t=1570520682442) - * [使用eureka](files/10112_使用eureka.md?t=1570520682442) - * [扩展其它注册中心](files/10113_扩展其它注册中心.md?t=1570520682442) + * [快速体验](files/10010_快速体验.md?t=1570521912281) + * [项目接入到SOP](files/10011_项目接入到SOP.md?t=1570521912300) + * [新增接口](files/10020_新增接口.md?t=1570521912300) + * [开发流程](files/10021_开发流程.md?t=1570521912300) + * [业务参数校验](files/10030_业务参数校验.md?t=1570521912301) + * [错误处理](files/10040_错误处理.md?t=1570521912301) + * [编写文档](files/10041_编写文档.md?t=1570521912301) + * [接口交互详解](files/10050_接口交互详解.md?t=1570521912301) + * [easyopen支持](files/10070_easyopen支持.md?t=1570521912301) + * [使用签名校验工具](files/10080_使用签名校验工具.md?t=1570521912301) + * [ISV管理](files/10085_ISV管理.md?t=1570521912301) + * [自定义返回结果](files/10087_自定义返回结果.md?t=1570521912301) + * [自定义过滤器](files/10088_自定义过滤器.md?t=1570521912302) + * [路由授权](files/10090_路由授权.md?t=1570521912302) + * [接口限流](files/10092_接口限流.md?t=1570521912302) + * [监控日志](files/10093_监控日志.md?t=1570521912302) + * [SDK开发](files/10095_SDK开发.md?t=1570521912302) + * [使用SpringCloudGateway](files/10096_使用SpringCloudGateway.md?t=1570521912302) + * [应用授权](files/10097_应用授权.md?t=1570521912302) + * [提供restful接口](files/10100_提供restful接口.md?t=1570521912302) + * [文件上传](files/10104_文件上传.md?t=1570521912302) + * [配置Sleuth链路追踪](files/10109_配置Sleuth链路追踪.md?t=1570521912303) + * [预发布灰度发布](files/10110_预发布灰度发布.md?t=1570521912303) + * [动态修改请求参数](files/10111_动态修改请求参数.md?t=1570521912303) + * [使用eureka](files/10112_使用eureka.md?t=1570521912303) + * [扩展其它注册中心](files/10113_扩展其它注册中心.md?t=1570521912303) * 原理分析 - * [原理分析之@ApiMapping](files/90010_原理分析之@ApiMapping.md?t=1570520682442) - * [原理分析之如何存储路由](files/90011_原理分析之如何存储路由.md?t=1570520682442) - * [原理分析之如何路由](files/90012_原理分析之如何路由.md?t=1570520682442) - * [原理分析之文档归纳](files/90013_原理分析之文档归纳.md?t=1570520682442) - * [常见问题](files/90100_常见问题.md?t=1570520682443) + * [原理分析之@ApiMapping](files/90010_原理分析之@ApiMapping.md?t=1570521912303) + * [原理分析之如何存储路由](files/90011_原理分析之如何存储路由.md?t=1570521912303) + * [原理分析之如何路由](files/90012_原理分析之如何路由.md?t=1570521912303) + * [原理分析之文档归纳](files/90013_原理分析之文档归纳.md?t=1570521912303) + * [常见问题](files/90100_常见问题.md?t=1570521912303) diff --git a/doc/docs/files/10070_easyopen支持.md b/doc/docs/files/10070_easyopen支持.md index 33e05965..1fe7c099 100644 --- a/doc/docs/files/10070_easyopen支持.md +++ b/doc/docs/files/10070_easyopen支持.md @@ -13,7 +13,7 @@ SOP对easyopen项目提供了很好的支持,如果您的服务端使用了eas com.gitee.sop sop-service-common - 2.2.0-SNAPSHOT + 2.3.0-SNAPSHOT diff --git a/sop-common/pom.xml b/sop-common/pom.xml index 66ca5cfa..31fe983a 100644 --- a/sop-common/pom.xml +++ b/sop-common/pom.xml @@ -5,7 +5,7 @@ 4.0.0 com.gitee.sop sop-common - 2.2.0-SNAPSHOT + 2.3.0-SNAPSHOT pom diff --git a/sop-common/sop-gateway-common/pom.xml b/sop-common/sop-gateway-common/pom.xml index 2b48b6ca..0dcc36d3 100644 --- a/sop-common/sop-gateway-common/pom.xml +++ b/sop-common/sop-gateway-common/pom.xml @@ -5,11 +5,11 @@ com.gitee.sop sop-common - 2.2.0-SNAPSHOT + 2.3.0-SNAPSHOT ../pom.xml sop-gateway-common - 2.2.0-SNAPSHOT + 2.3.0-SNAPSHOT jar sop-gateway-common diff --git a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/manager/EnvironmentKeys.java b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/manager/EnvironmentKeys.java index 8fee6e3e..5ff62d11 100644 --- a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/manager/EnvironmentKeys.java +++ b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/manager/EnvironmentKeys.java @@ -19,9 +19,9 @@ public enum EnvironmentKeys { SIGN_URLENCODE("sign.urlencode"), /** - * sop.web-model.enable=true,开启传统web开发模式 + * sop.restful.enable=true,开启传统web开发模式 */ - SOP_WEB_MODEL_ENABLE("sop.web-model.enable"); + SOP_RESTFUL_ENABLE("sop.restful.enable"); private String key; private String defaultValue; diff --git a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/route/ServiceRouteListener.java b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/route/ServiceRouteListener.java index ad6d147d..3a0f81d9 100644 --- a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/route/ServiceRouteListener.java +++ b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/route/ServiceRouteListener.java @@ -27,7 +27,7 @@ public class ServiceRouteListener extends BaseServiceListener { private static final String METADATA_SOP_ROUTES_PATH = "sop.routes.path"; - private static final String HEADER_WEB_MODEL = "web-model"; + private static final String HEADER_RESTFUL = "restful"; @Autowired private BaseRouteCache baseRouteCache; @@ -59,9 +59,9 @@ public class ServiceRouteListener extends BaseServiceListener { protected HttpEntity getHttpEntity() { HttpHeaders headers = new HttpHeaders(); - String webModel = EnvironmentKeys.SOP_WEB_MODEL_ENABLE.getValue(); - boolean isWebModel = "true".equals(webModel); - headers.add(HEADER_WEB_MODEL, String.valueOf(isWebModel)); + String restful = EnvironmentKeys.SOP_RESTFUL_ENABLE.getValue(); + boolean enableRestful = "true".equals(restful); + headers.add(HEADER_RESTFUL, String.valueOf(enableRestful)); return new HttpEntity<>(headers); } diff --git a/sop-common/sop-service-common/pom.xml b/sop-common/sop-service-common/pom.xml index 23811046..43ddc12a 100644 --- a/sop-common/sop-service-common/pom.xml +++ b/sop-common/sop-service-common/pom.xml @@ -6,11 +6,11 @@ com.gitee.sop sop-common - 2.2.0-SNAPSHOT + 2.3.0-SNAPSHOT ../pom.xml sop-service-common - 2.2.0-SNAPSHOT + 2.3.0-SNAPSHOT jar sop-service-common diff --git a/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/bean/ServiceContext.java b/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/bean/ServiceContext.java index 7e70dc74..2bef4145 100644 --- a/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/bean/ServiceContext.java +++ b/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/bean/ServiceContext.java @@ -14,7 +14,7 @@ public class ServiceContext extends ConcurrentHashMap { public static final String RESPONSE_KEY = "response"; public static final String OPEN_CONTEXT_KEY = "openContext"; - public static final String WEB_MODEL_KEY = "sop-web-model"; + public static final String RESTFUL_KEY = "sop-restful"; protected static Class contextClass = ServiceContext.class; diff --git a/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/manager/ApiMetaBuilder.java b/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/manager/ApiMetaBuilder.java index 2c519dcc..f705461d 100644 --- a/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/manager/ApiMetaBuilder.java +++ b/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/manager/ApiMetaBuilder.java @@ -88,7 +88,7 @@ public class ApiMetaBuilder { apiMeta.setPermission(BooleanUtils.toInteger(apiMappingInfo.isPermission())); return apiMeta; } else { - if (!ServiceContext.getCurrentContext().getBoolean(ServiceContext.WEB_MODEL_KEY, false)) { + if (!ServiceContext.getCurrentContext().getBoolean(ServiceContext.RESTFUL_KEY, false)) { return null; } String path = patterns.iterator().next(); diff --git a/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/manager/ServiceRouteController.java b/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/manager/ServiceRouteController.java index 0d0b1205..2d484611 100644 --- a/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/manager/ServiceRouteController.java +++ b/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/manager/ServiceRouteController.java @@ -24,7 +24,7 @@ import javax.servlet.http.HttpServletResponse; public class ServiceRouteController { private static final String SECRET = "a3d9sf!1@odl90zd>fkASwq"; - private static final String HEADER_WEB_MODEL = "web-model"; + private static final String HEADER_RESTFUL = "restful"; @Autowired private RequestMappingHandlerMapping requestMappingHandlerMapping; @@ -52,9 +52,9 @@ public class ServiceRouteController { throw new IllegalArgumentException("未指定spring.application.name参数"); } ApiMetaBuilder apiMetaBuilder = getApiMetaBuilder(); - String webModel = request.getHeader(HEADER_WEB_MODEL); - boolean isWebModel = "true".equals(webModel); - ServiceContext.getCurrentContext().set(ServiceContext.WEB_MODEL_KEY, isWebModel); + String restful = request.getHeader(HEADER_RESTFUL); + boolean enableRestful = "true".equals(restful); + ServiceContext.getCurrentContext().set(ServiceContext.RESTFUL_KEY, enableRestful); ServiceApiInfo serviceApiInfo = apiMetaBuilder.getServiceApiInfo(serviceId, requestMappingHandlerMapping); ServiceRouteInfoBuilder serviceRouteInfoBuilder = new ServiceRouteInfoBuilder(environment); return serviceRouteInfoBuilder.build(serviceApiInfo); diff --git a/sop-example/sop-book/sop-book-web/pom.xml b/sop-example/sop-book/sop-book-web/pom.xml index 31277dff..10b76abb 100644 --- a/sop-example/sop-book/sop-book-web/pom.xml +++ b/sop-example/sop-book/sop-book-web/pom.xml @@ -28,7 +28,7 @@ com.gitee.sop sop-service-common - 2.2.0-SNAPSHOT + 2.3.0-SNAPSHOT com.gitee.sop diff --git a/sop-example/sop-easyopen/pom.xml b/sop-example/sop-easyopen/pom.xml index 0c18c787..55af20a8 100644 --- a/sop-example/sop-easyopen/pom.xml +++ b/sop-example/sop-easyopen/pom.xml @@ -29,7 +29,7 @@ com.gitee.sop sop-service-common - 2.2.0-SNAPSHOT + 2.3.0-SNAPSHOT diff --git a/sop-example/sop-story/sop-story-web/pom.xml b/sop-example/sop-story/sop-story-web/pom.xml index e578f6e2..9f5e200f 100644 --- a/sop-example/sop-story/sop-story-web/pom.xml +++ b/sop-example/sop-story/sop-story-web/pom.xml @@ -28,7 +28,7 @@ com.gitee.sop sop-service-common - 2.2.0-SNAPSHOT + 2.3.0-SNAPSHOT com.gitee.sop diff --git a/sop-gateway/pom.xml b/sop-gateway/pom.xml index 790d5b9e..2becb391 100644 --- a/sop-gateway/pom.xml +++ b/sop-gateway/pom.xml @@ -29,7 +29,7 @@ com.gitee.sop sop-gateway-common - 2.2.0-SNAPSHOT + 2.3.0-SNAPSHOT diff --git a/sop-website/pom.xml b/sop-website/pom.xml index 5730e769..fc7d3af4 100644 --- a/sop-website/pom.xml +++ b/sop-website/pom.xml @@ -35,7 +35,7 @@ com.gitee.sop sop-gateway-common - 2.2.0-SNAPSHOT + 2.3.0-SNAPSHOT