You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by he...@apache.org on 2023/09/11 09:17:54 UTC
[shenyu] branch master updated: [type:fix] fix issue 4292. (#5089)
This is an automated email from the ASF dual-hosted git repository.
hefengen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new 03239a2020 [type:fix] fix issue 4292. (#5089)
03239a2020 is described below
commit 03239a20205d0564a99f0db95676268d43255165
Author: yunlongn <yu...@outlook.com>
AuthorDate: Mon Sep 11 17:17:48 2023 +0800
[type:fix] fix issue 4292. (#5089)
Co-authored-by: xiaoyu <xi...@apache.org>
---
.../client/core/client/AbstractContextRefreshedEventListener.java | 2 ++
.../client/springcloud/init/SpringCloudClientEventListener.java | 4 ++--
.../shenyu/client/springmvc/init/SpringMvcClientEventListener.java | 2 +-
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/shenyu-client/shenyu-client-core/src/main/java/org/apache/shenyu/client/core/client/AbstractContextRefreshedEventListener.java b/shenyu-client/shenyu-client-core/src/main/java/org/apache/shenyu/client/core/client/AbstractContextRefreshedEventListener.java
index 7b02545357..0ac55612be 100644
--- a/shenyu-client/shenyu-client-core/src/main/java/org/apache/shenyu/client/core/client/AbstractContextRefreshedEventListener.java
+++ b/shenyu-client/shenyu-client-core/src/main/java/org/apache/shenyu/client/core/client/AbstractContextRefreshedEventListener.java
@@ -81,6 +81,8 @@ public abstract class AbstractContextRefreshedEventListener<T, A extends Annotat
*/
protected static final String PATH_SEPARATOR = "/";
+ protected static final String EVERY_PATH = "**";
+
private final ShenyuClientRegisterEventPublisher publisher = ShenyuClientRegisterEventPublisher.getInstance();
private final AtomicBoolean registered = new AtomicBoolean(false);
diff --git a/shenyu-client/shenyu-client-http/shenyu-client-springcloud/src/main/java/org/apache/shenyu/client/springcloud/init/SpringCloudClientEventListener.java b/shenyu-client/shenyu-client-http/shenyu-client-springcloud/src/main/java/org/apache/shenyu/client/springcloud/init/SpringCloudClientEventListener.java
index 311adea806..21b9381b38 100644
--- a/shenyu-client/shenyu-client-http/shenyu-client-springcloud/src/main/java/org/apache/shenyu/client/springcloud/init/SpringCloudClientEventListener.java
+++ b/shenyu-client/shenyu-client-http/shenyu-client-springcloud/src/main/java/org/apache/shenyu/client/springcloud/init/SpringCloudClientEventListener.java
@@ -128,7 +128,7 @@ public class SpringCloudClientEventListener extends AbstractContextRefreshedEven
getPublisher().publishEvent(MetaDataRegisterDTO.builder()
.contextPath(getContextPath())
.appName(getAppName())
- .path(UriComponentsBuilder.fromUriString(PathUtils.decoratorPathWithSlash(getContextPath())).build().encode().toUriString())
+ .path(UriComponentsBuilder.fromUriString(PathUtils.decoratorPathWithSlash(getContextPath()) + EVERY_PATH).build().encode().toUriString())
.rpcType(RpcTypeEnum.SPRING_CLOUD.getName())
.enabled(true)
.ruleName(getContextPath())
@@ -242,7 +242,7 @@ public class SpringCloudClientEventListener extends AbstractContextRefreshedEven
.appName(getAppName())
.serviceName(clazz.getName())
.methodName(Optional.ofNullable(method).map(Method::getName).orElse(null))
- .path(UriComponentsBuilder.fromUriString(path).build().encode().toUriString())
+ .path(path)
.pathDesc(shenyuClient.desc())
.parameterTypes(Optional.ofNullable(method)
.map(m -> Arrays.stream(m.getParameterTypes())
diff --git a/shenyu-client/shenyu-client-http/shenyu-client-springmvc/src/main/java/org/apache/shenyu/client/springmvc/init/SpringMvcClientEventListener.java b/shenyu-client/shenyu-client-http/shenyu-client-springmvc/src/main/java/org/apache/shenyu/client/springmvc/init/SpringMvcClientEventListener.java
index bc096cc31a..f847a8afbd 100644
--- a/shenyu-client/shenyu-client-http/shenyu-client-springmvc/src/main/java/org/apache/shenyu/client/springmvc/init/SpringMvcClientEventListener.java
+++ b/shenyu-client/shenyu-client-http/shenyu-client-springmvc/src/main/java/org/apache/shenyu/client/springmvc/init/SpringMvcClientEventListener.java
@@ -125,7 +125,7 @@ public class SpringMvcClientEventListener extends AbstractContextRefreshedEventL
.contextPath(getContextPath())
.addPrefixed(addPrefixed)
.appName(getAppName())
- .path(UriComponentsBuilder.fromUriString(PathUtils.decoratorPathWithSlash(getContextPath())).build().encode().toUriString())
+ .path(UriComponentsBuilder.fromUriString(PathUtils.decoratorPathWithSlash(getContextPath()) + EVERY_PATH).build().encode().toUriString())
.rpcType(RpcTypeEnum.HTTP.getName())
.enabled(true)
.ruleName(getContextPath())