You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2022/08/14 13:12:19 UTC
[dubbo] branch 3.1 updated: fix GenericFilter get generic value (#10456)
This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch 3.1
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.1 by this push:
new e528bca7e5 fix GenericFilter get generic value (#10456)
e528bca7e5 is described below
commit e528bca7e533ecbdce6022a9e90e0469480a925f
Author: liufeiyu1002 <32...@users.noreply.github.com>
AuthorDate: Sun Aug 14 21:12:00 2022 +0800
fix GenericFilter get generic value (#10456)
---
.../main/java/org/apache/dubbo/rpc/filter/GenericFilter.java | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/GenericFilter.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/GenericFilter.java
index a09e285e6c..75dcd5c1bc 100644
--- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/GenericFilter.java
+++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/GenericFilter.java
@@ -97,7 +97,7 @@ public class GenericFilter implements Filter, Filter.Listener, ScopeModelAware {
String generic = inv.getAttachment(GENERIC_KEY);
if (StringUtils.isBlank(generic)) {
- generic = RpcContext.getClientAttachment().getAttachment(GENERIC_KEY);
+ generic = getGenericValueFromRpcContext();
}
if (StringUtils.isEmpty(generic)
@@ -205,6 +205,14 @@ public class GenericFilter implements Filter, Filter.Listener, ScopeModelAware {
}).toArray();
}
+ private String getGenericValueFromRpcContext(){
+ String generic = RpcContext.getServerAttachment().getAttachment(GENERIC_KEY);
+ if (StringUtils.isBlank(generic)){
+ generic = RpcContext.getClientAttachment().getAttachment(GENERIC_KEY);
+ }
+ return generic;
+ }
+
@Override
public void onResponse(Result appResponse, Invoker<?> invoker, Invocation inv) {
if ((inv.getMethodName().equals($INVOKE) || inv.getMethodName().equals($INVOKE_ASYNC))
@@ -214,7 +222,7 @@ public class GenericFilter implements Filter, Filter.Listener, ScopeModelAware {
String generic = inv.getAttachment(GENERIC_KEY);
if (StringUtils.isBlank(generic)) {
- generic = RpcContext.getClientAttachment().getAttachment(GENERIC_KEY);
+ generic = getGenericValueFromRpcContext();
}
if (appResponse.hasException()) {