Merge branch 'master' into eureka

eureka
tanghc 5 years ago
commit d63bf78aa8
  1. 10
      changelog.md
  2. 4
      sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/route/ZuulRouteRepository.java
  3. 8
      sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/controller/TraditionalWebappController.java

@ -1,5 +1,9 @@
# changelog
## 2.5.7
- 优化restful接口调用
## 2.5.6
- 优化文档显示
@ -9,15 +13,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校验枚举对象问题

@ -45,6 +45,10 @@ public class ZuulRouteRepository implements RouteRepository<ZuulTargetRoute> {
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

@ -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();

Loading…
Cancel
Save