From e1f96634871f2e27e0d511b7b3e54a29e1386d51 Mon Sep 17 00:00:00 2001 From: tanghc Date: Fri, 29 Nov 2019 14:54:52 +0800 Subject: [PATCH 1/5] 2.5.6 --- changelog.md | 6 +++--- .../com/gitee/sop/storyweb/controller/AlipayController.java | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/changelog.md b/changelog.md index fca5cf17..35f26da0 100644 --- a/changelog.md +++ b/changelog.md @@ -9,15 +9,15 @@ - 优化文档显示 -## 2.5.4 +## 2.5.4(不建议使用) - 可排除其它服务(`sop.service.exclude=your-serviceId1,your-serviceId2`) -## 2.5.3 +## 2.5.3(不建议使用) - 修复JSR-303校验问题 -## 2.5.2 +## 2.5.2(不建议使用) - 修复JSR-303校验枚举对象问题 diff --git a/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/controller/AlipayController.java b/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/controller/AlipayController.java index 5215183d..3d6556ff 100644 --- a/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/controller/AlipayController.java +++ b/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/controller/AlipayController.java @@ -134,6 +134,7 @@ public class AlipayController { // 遗留接口具备开放平台能力 @ApiAbility @GetMapping("getStory2") + @ApiOperation(value="JSONObject", notes = "JSONObject") public StoryResult getStory2_0(@RequestBody JSONObject param) { StoryResult story = new StoryResult(); story.setId(1L); From bddb668452d969bf2562347ee4b5c8c1a688ff0d Mon Sep 17 00:00:00 2001 From: tanghc Date: Fri, 29 Nov 2019 14:56:35 +0800 Subject: [PATCH 2/5] 2.5.6 --- .../java/com/gitee/sop/storyweb/controller/AlipayController.java | 1 - 1 file changed, 1 deletion(-) diff --git a/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/controller/AlipayController.java b/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/controller/AlipayController.java index 3d6556ff..5215183d 100644 --- a/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/controller/AlipayController.java +++ b/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/controller/AlipayController.java @@ -134,7 +134,6 @@ public class AlipayController { // 遗留接口具备开放平台能力 @ApiAbility @GetMapping("getStory2") - @ApiOperation(value="JSONObject", notes = "JSONObject") public StoryResult getStory2_0(@RequestBody JSONObject param) { StoryResult story = new StoryResult(); story.setId(1L); From 0f0c1ec7107b954c9c42eac26aacbd2a137968a9 Mon Sep 17 00:00:00 2001 From: tanghc Date: Tue, 3 Dec 2019 11:57:18 +0800 Subject: [PATCH 3/5] =?UTF-8?q?restful=E8=B0=83=E7=94=A8=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sop/gatewaycommon/zuul/route/ZuulRouteRepository.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/route/ZuulRouteRepository.java b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/route/ZuulRouteRepository.java index d1479d97..e25f5aac 100644 --- a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/route/ZuulRouteRepository.java +++ b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/route/ZuulRouteRepository.java @@ -45,6 +45,10 @@ public class ZuulRouteRepository implements RouteRepository { private ZuulTargetRoute clone(String path, ZuulTargetRoute zuulTargetRoute) { Route targetRouteDefinition = zuulTargetRoute.getTargetRouteDefinition(); + String prefix = "/" + zuulTargetRoute.getServiceRouteInfo().getServiceId(); + if (path.startsWith(prefix)) { + path = path.substring(prefix.length()); + } Route route = new Route( targetRouteDefinition.getId() ,path From bb3f45b197484250056bfe90dbf64ea4133e10c1 Mon Sep 17 00:00:00 2001 From: tanghc Date: Tue, 3 Dec 2019 11:57:40 +0800 Subject: [PATCH 4/5] =?UTF-8?q?restful=E8=B0=83=E7=94=A8=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../storyweb/controller/TraditionalWebappController.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/controller/TraditionalWebappController.java b/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/controller/TraditionalWebappController.java index 7cf77b49..9c199f1f 100644 --- a/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/controller/TraditionalWebappController.java +++ b/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/controller/TraditionalWebappController.java @@ -26,7 +26,7 @@ import java.util.Collection; public class TraditionalWebappController { - // http://localhost:8081/rest/food/getFoodById?id=1 网关入口 + // http://localhost:8081/rest/story-service/food/getFoodById?id=1 网关入口 // http://localhost:2222/food/getFoodById/?id=12 本地入口 @ApiOperation(value="获取食物", notes = "根据id获取食物") @RequestMapping(value = "getFoodById", method = RequestMethod.GET) @@ -38,13 +38,13 @@ public class TraditionalWebappController { return food; } - // http://localhost:8081/rest/food/getFoodByObj?id=2 + // http://localhost:8081/rest/story-service/food/getFoodByObj?id=2 @RequestMapping(value = "getFoodByObj", method = RequestMethod.GET) public Food getFoodByObj(Food food) { return food; } - // http://localhost:8081/rest/food/saveFood + // http://localhost:8081/rest/story-service/food/saveFood @RequestMapping(value = "saveFood", method = RequestMethod.POST) public Food saveFood(@RequestBody Food food) { food.setId(3); @@ -79,7 +79,7 @@ public class TraditionalWebappController { } // http://localhost:2222/food/get/3 本地 - // http://localhost:8081/rest/food/get/3 网关访问 + // http://localhost:8081/rest/story-service/food/get/3 网关访问 @RequestMapping("/get/{id}") public Food getById(@PathVariable("id") Integer id) { Food food = new Food(); From a50f73563a8897563aa50ddabad4e400d3d84176 Mon Sep 17 00:00:00 2001 From: tanghc Date: Tue, 3 Dec 2019 12:03:12 +0800 Subject: [PATCH 5/5] 2.5.7 --- changelog.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/changelog.md b/changelog.md index 35f26da0..33c4d8ab 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # changelog +## 2.5.7 + +- 优化restful接口调用 + ## 2.5.6 - 优化文档显示