From 91f8c82f0e0e66542e5de3d22ab83e99c0e79f3b Mon Sep 17 00:00:00 2001 From: tanghc Date: Tue, 2 Mar 2021 14:28:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 5 +++++ .../storyweb/controller/Example1001_BaseController.java | 2 +- .../gitee/sop/gateway/interceptor/MyRouteInterceptor.java | 8 +++++++- .../src/test/java/com/gitee/sop/test/AllInOneTest.java | 2 +- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 25a95e36..9242a9ce 100644 --- a/pom.xml +++ b/pom.xml @@ -73,6 +73,11 @@ + + io.projectreactor.netty + reactor-netty + 0.8.19.RELEASE + org.springframework.boot diff --git a/sop-example/sop-story/src/main/java/com/gitee/sop/storyweb/controller/Example1001_BaseController.java b/sop-example/sop-story/src/main/java/com/gitee/sop/storyweb/controller/Example1001_BaseController.java index 38737f8a..879d2762 100644 --- a/sop-example/sop-story/src/main/java/com/gitee/sop/storyweb/controller/Example1001_BaseController.java +++ b/sop-example/sop-story/src/main/java/com/gitee/sop/storyweb/controller/Example1001_BaseController.java @@ -152,7 +152,7 @@ public class Example1001_BaseController { // 忽略验证 @ApiOperation(value = "忽略签名验证", notes = "忽略签名验证") @Open(value = "story.get.ignore", ignoreValidate = true) - @PostMapping(value = "/get/ignore/v1") + @RequestMapping(value = "/get/ignore/v1") public StoryResult getStory21(@RequestBody StoryParam story) { StoryResult result = new StoryResult(); result.setId((long) story.getId()); diff --git a/sop-gateway/src/main/java/com/gitee/sop/gateway/interceptor/MyRouteInterceptor.java b/sop-gateway/src/main/java/com/gitee/sop/gateway/interceptor/MyRouteInterceptor.java index 4ff60784..8e534a70 100644 --- a/sop-gateway/src/main/java/com/gitee/sop/gateway/interceptor/MyRouteInterceptor.java +++ b/sop-gateway/src/main/java/com/gitee/sop/gateway/interceptor/MyRouteInterceptor.java @@ -5,6 +5,9 @@ import com.gitee.sop.gatewaycommon.interceptor.RouteInterceptorContext; import com.gitee.sop.gatewaycommon.param.ApiParam; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; +import org.springframework.web.server.ServerWebExchange; + +import java.net.URI; /** * 演示拦截器 @@ -18,7 +21,10 @@ public class MyRouteInterceptor implements RouteInterceptor { @Override public void preRoute(RouteInterceptorContext context) { ApiParam apiParam = context.getApiParam(); - log.info("请求接口:{}, request_id:{}, app_id:{}, ip:{}", + ServerWebExchange exchange = (ServerWebExchange) context.getRequestContext(); + URI uri = exchange.getRequest().getURI(); + log.info("请求URL:{}, 请求接口:{}, request_id:{}, app_id:{}, ip:{}", + uri, apiParam.fetchNameVersion(), apiParam.fetchRequestId(), apiParam.fetchAppKey(), diff --git a/sop-test/src/test/java/com/gitee/sop/test/AllInOneTest.java b/sop-test/src/test/java/com/gitee/sop/test/AllInOneTest.java index c6e01035..7ee918a8 100644 --- a/sop-test/src/test/java/com/gitee/sop/test/AllInOneTest.java +++ b/sop-test/src/test/java/com/gitee/sop/test/AllInOneTest.java @@ -102,7 +102,7 @@ public class AllInOneTest extends TestBase { .version("1.0") .ignoreSign(true) .bizContent(new BizContent().add("id", "222").add("name", "忽略222")) - .httpMethod(HttpTool.HTTPMethod.POST); + .httpMethod(HttpTool.HTTPMethod.GET); client.execute(requestBuilder); }