diff --git a/dubbo-common/src/main/java/org/apache/dubbo/config/nested/RestConfig.java b/dubbo-common/src/main/java/org/apache/dubbo/config/nested/RestConfig.java
index 4e8d6a54eff..be813c68e59 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/config/nested/RestConfig.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/config/nested/RestConfig.java
@@ -67,6 +67,11 @@ public class RestConfig implements Serializable {
*/
private String jsonFramework;
+ /**
+ * The disallowed content-types.
+ */
+ private String[] disallowedContentTypes;
+
/**
* The cors configuration.
*/
@@ -133,6 +138,14 @@ public void setJsonFramework(String jsonFramework) {
this.jsonFramework = jsonFramework;
}
+ public String[] getDisallowedContentTypes() {
+ return disallowedContentTypes;
+ }
+
+ public void setDisallowedContentTypes(String[] disallowedContentTypes) {
+ this.disallowedContentTypes = disallowedContentTypes;
+ }
+
public CorsConfig getCors() {
return cors;
}
diff --git a/dubbo-config/dubbo-config-spring6/pom.xml b/dubbo-config/dubbo-config-spring6/pom.xml
index ec4461ae463..b02a938c005 100644
--- a/dubbo-config/dubbo-config-spring6/pom.xml
+++ b/dubbo-config/dubbo-config-spring6/pom.xml
@@ -28,7 +28,7 @@
17
17
- 6.0.11
+ 6.1.13
3.0.9
diff --git a/dubbo-config/dubbo-config-spring6/src/main/java/org/apache/dubbo/config/spring6/beans/factory/annotation/ReferenceAnnotationWithAotBeanPostProcessor.java b/dubbo-config/dubbo-config-spring6/src/main/java/org/apache/dubbo/config/spring6/beans/factory/annotation/ReferenceAnnotationWithAotBeanPostProcessor.java
index 971e010e418..0a165b0e156 100644
--- a/dubbo-config/dubbo-config-spring6/src/main/java/org/apache/dubbo/config/spring6/beans/factory/annotation/ReferenceAnnotationWithAotBeanPostProcessor.java
+++ b/dubbo-config/dubbo-config-spring6/src/main/java/org/apache/dubbo/config/spring6/beans/factory/annotation/ReferenceAnnotationWithAotBeanPostProcessor.java
@@ -261,7 +261,17 @@ private CodeBlock generateStatementForElement(
Class> c = referenceElement.getInjectedType();
AotUtils.registerSerializationForService(c, hints);
hints.reflection().registerType(TypeReference.of(c), MemberCategory.INVOKE_PUBLIC_METHODS);
+ // need to enumerate all interfaces by the proxy
+ hints.proxies().registerJdkProxy(c, EchoService.class, Destroyable.class);
hints.proxies().registerJdkProxy(c, EchoService.class, Destroyable.class, GenericService.class);
+ hints.proxies()
+ .registerJdkProxy(
+ c,
+ EchoService.class,
+ Destroyable.class,
+ SpringProxy.class,
+ Advised.class,
+ DecoratingProxy.class);
hints.proxies()
.registerJdkProxy(
c,
diff --git a/dubbo-demo/dubbo-demo-native/dubbo-demo-native-consumer/pom.xml b/dubbo-demo/dubbo-demo-native/dubbo-demo-native-consumer/pom.xml
index c64e647ec2a..40707afb12c 100644
--- a/dubbo-demo/dubbo-demo-native/dubbo-demo-native-consumer/pom.xml
+++ b/dubbo-demo/dubbo-demo-native/dubbo-demo-native-consumer/pom.xml
@@ -29,7 +29,7 @@
true
- 5.1.0
+ 5.7.0
3.8.4
@@ -199,7 +199,7 @@
org.graalvm.buildtools
native-maven-plugin
- 0.10.2
+ 0.10.3
${project.build.outputDirectory}
diff --git a/dubbo-demo/dubbo-demo-native/dubbo-demo-native-provider/pom.xml b/dubbo-demo/dubbo-demo-native/dubbo-demo-native-provider/pom.xml
index c6d4098527e..23f7670bfd6 100644
--- a/dubbo-demo/dubbo-demo-native/dubbo-demo-native-provider/pom.xml
+++ b/dubbo-demo/dubbo-demo-native/dubbo-demo-native-provider/pom.xml
@@ -29,7 +29,7 @@
true
- 5.1.0
+ 5.7.0
3.8.4
@@ -199,7 +199,7 @@
org.graalvm.buildtools
native-maven-plugin
- 0.10.2
+ 0.10.3
${project.build.outputDirectory}
diff --git a/dubbo-dependencies-bom/pom.xml b/dubbo-dependencies-bom/pom.xml
index 910b8ac61a2..657d3b16d7c 100644
--- a/dubbo-dependencies-bom/pom.xml
+++ b/dubbo-dependencies-bom/pom.xml
@@ -99,13 +99,13 @@
4.5.14
4.4.16
1.2.83
- 2.0.52
+ 2.0.53
3.7.2
- 5.1.0
+ 5.7.0
2.12.0
3.10.0
4.0.66
- 3.25.4
+ 3.25.5
1.3.2
3.1.0
6.1.0
@@ -120,14 +120,14 @@
2.3
3.17.0
0.1.35
- 1.13.3
+ 1.13.4
1.39.0
- 3.4.0
- 1.3.3
+ 3.4.2
+ 1.3.4
3.3
0.16.0
1.0.4
- 3.6.9
+ 3.6.10
2.2.21
3.14.9
@@ -136,12 +136,12 @@
1.9.13
8.5.100
2.4.2
- 1.8.6
- 1.6.1
- 1.66.0
+ 1.8.8
+ 1.8.0
+ 1.68.0
0.8.1
1.2.2
- 0.9.10
+ 0.9.14
1.7.36
1.3.4
@@ -149,14 +149,14 @@
1.2.13
2.24.0
- 2.16.1
+ 2.17.0
1.16.0
- 4.0.21
+ 4.0.23
5.9.3
4.13.2
- 4.2.0
+ 4.2.2
2.2
2.2.2
1.4.3
@@ -169,7 +169,7 @@
4.0.3
1.6.14
- 1.1.10.6
+ 1.1.10.7
1.70
5.4.3
2.0.6
@@ -183,9 +183,9 @@
check
1.0.0
2.38.0
- 3.1.5
- 4.0.1
- 2.3.3-b02
+ 3.1.9
+ 4.0.2
+ 2.4.0-b180830.0438
3.3.1-SNAPSHOT
diff --git a/dubbo-maven-plugin/pom.xml b/dubbo-maven-plugin/pom.xml
index 18053831594..1cceffbaaa8 100644
--- a/dubbo-maven-plugin/pom.xml
+++ b/dubbo-maven-plugin/pom.xml
@@ -29,7 +29,7 @@
${revision}
- 3.25.0
+ 3.25.5
@@ -75,7 +75,7 @@
commons-io
commons-io
- 2.16.1
+ 2.17.0
diff --git a/dubbo-plugin/dubbo-compiler/src/main/java/org/apache/dubbo/gen/AbstractGenerator.java b/dubbo-plugin/dubbo-compiler/src/main/java/org/apache/dubbo/gen/AbstractGenerator.java
index 1bb19215bac..c434ec47fcb 100644
--- a/dubbo-plugin/dubbo-compiler/src/main/java/org/apache/dubbo/gen/AbstractGenerator.java
+++ b/dubbo-plugin/dubbo-compiler/src/main/java/org/apache/dubbo/gen/AbstractGenerator.java
@@ -210,14 +210,14 @@ private List generateFiles(List buildFile(ServiceContext context) {
List files = new ArrayList<>();
- if (context.multipleFiles && enableMultipleTemplateFiles()) {
+ if (useMultipleTemplate(context.multipleFiles)) {
String content = applyTemplate(getTemplateFileName(), context);
String dir = absoluteDir(context);
diff --git a/dubbo-plugin/dubbo-compiler/src/main/java/org/apache/dubbo/gen/tri/Dubbo3TripleGenerator.java b/dubbo-plugin/dubbo-compiler/src/main/java/org/apache/dubbo/gen/tri/Dubbo3TripleGenerator.java
index 3cb8ff91fdd..db43b0d7478 100644
--- a/dubbo-plugin/dubbo-compiler/src/main/java/org/apache/dubbo/gen/tri/Dubbo3TripleGenerator.java
+++ b/dubbo-plugin/dubbo-compiler/src/main/java/org/apache/dubbo/gen/tri/Dubbo3TripleGenerator.java
@@ -51,7 +51,7 @@ protected String getSingleTemplateFileName() {
}
@Override
- protected boolean enableMultipleTemplateFiles() {
+ protected boolean useMultipleTemplate(boolean multipleFiles) {
return true;
}
}
diff --git a/dubbo-plugin/dubbo-compiler/src/main/java/org/apache/dubbo/gen/tri/reactive/ReactorDubbo3TripleGenerator.java b/dubbo-plugin/dubbo-compiler/src/main/java/org/apache/dubbo/gen/tri/reactive/ReactorDubbo3TripleGenerator.java
index 26a25a8b5f9..b0f7b1b8d99 100644
--- a/dubbo-plugin/dubbo-compiler/src/main/java/org/apache/dubbo/gen/tri/reactive/ReactorDubbo3TripleGenerator.java
+++ b/dubbo-plugin/dubbo-compiler/src/main/java/org/apache/dubbo/gen/tri/reactive/ReactorDubbo3TripleGenerator.java
@@ -51,7 +51,7 @@ protected String getSingleTemplateFileName() {
}
@Override
- protected boolean enableMultipleTemplateFiles() {
+ protected boolean useMultipleTemplate(boolean multipleFiles) {
return true;
}
}
diff --git a/dubbo-plugin/dubbo-triple-servlet/src/main/java/org/apache/dubbo/rpc/protocol/tri/servlet/TripleFilter.java b/dubbo-plugin/dubbo-triple-servlet/src/main/java/org/apache/dubbo/rpc/protocol/tri/servlet/TripleFilter.java
index 85175d3d24e..891cc244409 100644
--- a/dubbo-plugin/dubbo-triple-servlet/src/main/java/org/apache/dubbo/rpc/protocol/tri/servlet/TripleFilter.java
+++ b/dubbo-plugin/dubbo-triple-servlet/src/main/java/org/apache/dubbo/rpc/protocol/tri/servlet/TripleFilter.java
@@ -125,8 +125,10 @@ private void handleHttp1(HttpServletRequest request, HttpServletResponse respons
channel, ServletExchanger.getUrl(), FrameworkModel.defaultModel());
channel.setGrpc(false);
context.setTimeout(resolveTimeout(request, false));
- listener.onMetadata(new HttpMetadataAdapter(request));
ServletInputStream is = request.getInputStream();
+ response.getOutputStream().setWriteListener(new TripleWriteListener(channel));
+
+ listener.onMetadata(new HttpMetadataAdapter(request));
listener.onData(new Http1InputMessage(
is.available() == 0 ? StreamUtils.EMPTY : new ByteArrayInputStream(StreamUtils.readBytes(is))));
} catch (Throwable t) {
diff --git a/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/message/codec/CodecUtils.java b/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/message/codec/CodecUtils.java
index 2b63feb1b09..143857e5fa0 100644
--- a/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/message/codec/CodecUtils.java
+++ b/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/message/codec/CodecUtils.java
@@ -17,17 +17,24 @@
package org.apache.dubbo.remoting.http12.message.codec;
import org.apache.dubbo.common.URL;
+import org.apache.dubbo.common.config.Configuration;
+import org.apache.dubbo.common.config.ConfigurationUtils;
import org.apache.dubbo.common.utils.Assert;
+import org.apache.dubbo.common.utils.StringUtils;
import org.apache.dubbo.remoting.http12.exception.UnsupportedMediaTypeException;
import org.apache.dubbo.remoting.http12.message.HttpMessageDecoder;
import org.apache.dubbo.remoting.http12.message.HttpMessageDecoderFactory;
import org.apache.dubbo.remoting.http12.message.HttpMessageEncoder;
import org.apache.dubbo.remoting.http12.message.HttpMessageEncoderFactory;
+import org.apache.dubbo.rpc.Constants;
import org.apache.dubbo.rpc.model.FrameworkModel;
+import java.util.Collections;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
public final class CodecUtils {
@@ -37,13 +44,18 @@ public final class CodecUtils {
private final List encoderFactories;
private final Map> encoderCache = new ConcurrentHashMap<>();
private final Map> decoderCache = new ConcurrentHashMap<>();
+ private Set disallowedContentTypes = Collections.emptySet();
public CodecUtils(FrameworkModel frameworkModel) {
this.frameworkModel = frameworkModel;
decoderFactories = frameworkModel.getActivateExtensions(HttpMessageDecoderFactory.class);
encoderFactories = frameworkModel.getActivateExtensions(HttpMessageEncoderFactory.class);
- decoderFactories.forEach(f -> decoderCache.putIfAbsent(f.mediaType().getName(), Optional.of(f)));
- encoderFactories.forEach(f -> encoderCache.putIfAbsent(f.mediaType().getName(), Optional.of(f)));
+
+ Configuration configuration = ConfigurationUtils.getGlobalConfiguration(frameworkModel.defaultApplication());
+ String contentTypes = configuration.getString(Constants.H2_SETTINGS_DISALLOWED_CONTENT_TYPES, null);
+ if (contentTypes != null) {
+ disallowedContentTypes = new HashSet<>(StringUtils.tokenizeToList(contentTypes));
+ }
}
public HttpMessageDecoder determineHttpMessageDecoder(URL url, String mediaType) {
@@ -69,9 +81,10 @@ public HttpMessageEncoder determineHttpMessageEncoder(String mediaType) {
public Optional determineHttpMessageDecoderFactory(String mediaType) {
Assert.notNull(mediaType, "mediaType must not be null");
return decoderCache.computeIfAbsent(mediaType, k -> {
- for (HttpMessageDecoderFactory decoderFactory : decoderFactories) {
- if (decoderFactory.supports(k)) {
- return Optional.of(decoderFactory);
+ for (HttpMessageDecoderFactory factory : decoderFactories) {
+ if (factory.supports(k)
+ && !disallowedContentTypes.contains(factory.mediaType().getName())) {
+ return Optional.of(factory);
}
}
return Optional.empty();
@@ -81,9 +94,10 @@ public Optional determineHttpMessageDecoderFactory(St
public Optional determineHttpMessageEncoderFactory(String mediaType) {
Assert.notNull(mediaType, "mediaType must not be null");
return encoderCache.computeIfAbsent(mediaType, k -> {
- for (HttpMessageEncoderFactory encoderFactory : encoderFactories) {
- if (encoderFactory.supports(k)) {
- return Optional.of(encoderFactory);
+ for (HttpMessageEncoderFactory factory : encoderFactories) {
+ if (factory.supports(k)
+ && !disallowedContentTypes.contains(factory.mediaType().getName())) {
+ return Optional.of(factory);
}
}
return Optional.empty();
diff --git a/dubbo-remoting/dubbo-remoting-zookeeper-curator5/pom.xml b/dubbo-remoting/dubbo-remoting-zookeeper-curator5/pom.xml
index 5b8510d6f88..ce66eb23286 100644
--- a/dubbo-remoting/dubbo-remoting-zookeeper-curator5/pom.xml
+++ b/dubbo-remoting/dubbo-remoting-zookeeper-curator5/pom.xml
@@ -30,7 +30,7 @@
false
3.7.2
- 5.1.0
+ 5.7.0
diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/Constants.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/Constants.java
index 3e348801874..d7512eeb88d 100644
--- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/Constants.java
+++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/Constants.java
@@ -109,6 +109,7 @@ public interface Constants {
String H2_SETTINGS_BUILTIN_SERVICE_INIT = "dubbo.tri.builtin.service.init";
String H2_SETTINGS_JSON_FRAMEWORK_NAME = "dubbo.protocol.triple.rest.json-framework";
+ String H2_SETTINGS_DISALLOWED_CONTENT_TYPES = "dubbo.protocol.triple.rest.disallowed-content-types";
String H2_SETTINGS_VERBOSE_ENABLED = "dubbo.protocol.triple.verbose";
String H2_SETTINGS_SERVLET_ENABLED = "dubbo.protocol.triple.servlet.enabled";
diff --git a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/h12/http1/Http1UnaryServerChannelObserver.java b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/h12/http1/Http1UnaryServerChannelObserver.java
index a6cc821994d..1aa994de525 100644
--- a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/h12/http1/Http1UnaryServerChannelObserver.java
+++ b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/h12/http1/Http1UnaryServerChannelObserver.java
@@ -24,6 +24,9 @@
import org.apache.dubbo.rpc.protocol.tri.ExceptionUtils;
import org.apache.dubbo.rpc.protocol.tri.TripleProtocol;
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+
import io.netty.buffer.ByteBufOutputStream;
public final class Http1UnaryServerChannelObserver extends Http1ServerChannelObserver {
@@ -52,7 +55,17 @@ protected void doOnError(Throwable throwable) throws Throwable {
@Override
protected void customizeHeaders(HttpHeaders headers, Throwable throwable, HttpOutputMessage message) {
super.customizeHeaders(headers, throwable, message);
- int contentLength = message == null ? 0 : ((ByteBufOutputStream) message.getBody()).writtenBytes();
+ int contentLength = 0;
+ if (message != null) {
+ OutputStream body = message.getBody();
+ if (body instanceof ByteBufOutputStream) {
+ contentLength = ((ByteBufOutputStream) body).writtenBytes();
+ } else if (body instanceof ByteArrayOutputStream) {
+ contentLength = ((ByteArrayOutputStream) body).size();
+ } else {
+ throw new IllegalArgumentException("Unsupported body type: " + body.getClass());
+ }
+ }
headers.set(HttpHeaderNames.CONTENT_LENGTH.getKey(), String.valueOf(contentLength));
}
diff --git a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/rest/mapping/DefaultRequestMappingRegistry.java b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/rest/mapping/DefaultRequestMappingRegistry.java
index f219b854038..8ec6bf4716c 100644
--- a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/rest/mapping/DefaultRequestMappingRegistry.java
+++ b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/rest/mapping/DefaultRequestMappingRegistry.java
@@ -22,6 +22,7 @@
import org.apache.dubbo.config.context.ConfigManager;
import org.apache.dubbo.config.nested.RestConfig;
import org.apache.dubbo.remoting.http12.HttpRequest;
+import org.apache.dubbo.remoting.http12.exception.HttpStatusException;
import org.apache.dubbo.remoting.http12.message.MethodMetadata;
import org.apache.dubbo.rpc.Invoker;
import org.apache.dubbo.rpc.model.FrameworkModel;
@@ -45,6 +46,7 @@
import java.lang.reflect.Method;
import java.util.ArrayList;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -205,7 +207,8 @@ public HandlerMeta lookup(HttpRequest request) {
KeyString path = new KeyString(stringPath, restConfig.getCaseSensitiveMatchOrDefault());
List candidates = new ArrayList<>();
- tryMatch(request, path, candidates);
+ List partialMatches = new LinkedList<>();
+ tryMatch(request, path, candidates, partialMatches);
if (candidates.isEmpty()) {
int end = path.length();
@@ -213,7 +216,7 @@ public HandlerMeta lookup(HttpRequest request) {
if (restConfig.getTrailingSlashMatchOrDefault()) {
if (path.charAt(end - 1) == '/') {
end--;
- tryMatch(request, path.subSequence(0, end), candidates);
+ tryMatch(request, path.subSequence(0, end), candidates, partialMatches);
}
}
@@ -225,7 +228,7 @@ public HandlerMeta lookup(HttpRequest request) {
}
if (ch == '.' && restConfig.getSuffixPatternMatchOrDefault()) {
if (contentNegotiator.supportExtension(path.toString(i + 1, end))) {
- tryMatch(request, path.subSequence(0, i), candidates);
+ tryMatch(request, path.subSequence(0, i), candidates, partialMatches);
if (!candidates.isEmpty()) {
break;
}
@@ -234,7 +237,7 @@ public HandlerMeta lookup(HttpRequest request) {
}
if (ch == '~') {
request.setAttribute(RestConstants.SIG_ATTRIBUTE, path.toString(i + 1, end));
- tryMatch(request, path.subSequence(0, i), candidates);
+ tryMatch(request, path.subSequence(0, i), candidates, partialMatches);
if (!candidates.isEmpty()) {
break;
}
@@ -245,6 +248,7 @@ public HandlerMeta lookup(HttpRequest request) {
int size = candidates.size();
if (size == 0) {
+ handleNoMatch(request, partialMatches);
return null;
}
if (size > 1) {
@@ -289,7 +293,8 @@ public HandlerMeta lookup(HttpRequest request) {
return handler;
}
- private void tryMatch(HttpRequest request, KeyString path, List candidates) {
+ private void tryMatch(
+ HttpRequest request, KeyString path, List candidates, List partialMatches) {
List> matches = new ArrayList<>();
lock.readLock().lock();
@@ -315,6 +320,47 @@ private void tryMatch(HttpRequest request, KeyString path, List candi
candidates.add(candidate);
}
}
+ if (candidates.isEmpty()) {
+ for (int i = 0; i < size; i++) {
+ partialMatches.add(matches.get(i).getValue().mapping);
+ }
+ }
+ }
+
+ private void handleNoMatch(HttpRequest request, List partialMatches) {
+ if (partialMatches.isEmpty()) {
+ return;
+ }
+ boolean methodsMismatch = true;
+ boolean consumesMismatch = true;
+ boolean producesMismatch = true;
+ boolean paramsMismatch = true;
+ for (RequestMapping mapping : partialMatches) {
+ if (methodsMismatch) {
+ methodsMismatch = !mapping.matchMethod(request.method());
+ }
+ if (consumesMismatch) {
+ consumesMismatch = !mapping.matchConsumes(request);
+ }
+ if (producesMismatch) {
+ producesMismatch = !mapping.matchProduces(request);
+ }
+ if (paramsMismatch) {
+ paramsMismatch = !mapping.matchParams(request);
+ }
+ }
+ if (methodsMismatch) {
+ throw new HttpStatusException(405, "Request method '" + request.method() + "' not supported");
+ }
+ if (consumesMismatch) {
+ throw new HttpStatusException(415, "Content type '" + request.contentType() + "' not supported");
+ }
+ if (producesMismatch) {
+ throw new HttpStatusException(406, "Could not find acceptable representation");
+ }
+ if (paramsMismatch) {
+ throw new HttpStatusException(400, "Unsatisfied query parameter conditions");
+ }
}
@Override
diff --git a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/rest/mapping/RequestMapping.java b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/rest/mapping/RequestMapping.java
index 1ea35e0e82a..4264594e012 100644
--- a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/rest/mapping/RequestMapping.java
+++ b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/rest/mapping/RequestMapping.java
@@ -119,6 +119,18 @@ public boolean matchMethod(String method) {
return methodsCondition == null || methodsCondition.getMethods().contains(method);
}
+ public boolean matchParams(HttpRequest request) {
+ return paramsCondition == null || paramsCondition.match(request) != null;
+ }
+
+ public boolean matchConsumes(HttpRequest request) {
+ return consumesCondition == null || consumesCondition.match(request) != null;
+ }
+
+ public boolean matchProduces(HttpRequest request) {
+ return producesCondition == null || producesCondition.match(request) != null;
+ }
+
@Override
public RequestMapping match(HttpRequest request) {
return doMatch(request, null);
@@ -196,10 +208,6 @@ public String getName() {
return name;
}
- public String getSig() {
- return sig;
- }
-
public PathCondition getPathCondition() {
return pathCondition;
}
diff --git a/dubbo-rpc/dubbo-rpc-triple/src/test/groovy/org/apache/dubbo/rpc/protocol/tri/rest/support/basic/RestProtocolTest.groovy b/dubbo-rpc/dubbo-rpc-triple/src/test/groovy/org/apache/dubbo/rpc/protocol/tri/rest/support/basic/RestProtocolTest.groovy
index 4b3547d238d..4a2da172b99 100644
--- a/dubbo-rpc/dubbo-rpc-triple/src/test/groovy/org/apache/dubbo/rpc/protocol/tri/rest/support/basic/RestProtocolTest.groovy
+++ b/dubbo-rpc/dubbo-rpc-triple/src/test/groovy/org/apache/dubbo/rpc/protocol/tri/rest/support/basic/RestProtocolTest.groovy
@@ -241,7 +241,27 @@ class RestProtocolTest extends BaseServiceTest {
path | accept | output
'/produceTest?name=world' | '' | 'world'
'/produceTest?name=world' | 'text/plain' | 'world'
- '/produceTest?name=world' | 'application/json' | '{"message":"Invoker not found","status":"404"}'
+ '/produceTest?name=world' | 'application/json' | '{"message":"Could not find acceptable representation","status":"406"}'
+ }
+
+ def "mismatch test"() {
+ given:
+ def request = new TestRequest(
+ method: method,
+ path: path,
+ contentType: contentType,
+ accept: accept
+ )
+ expect:
+ runner.run(request, String.class) == output
+ where:
+ method | path | contentType | accept | output
+ 'POST' | '/mismatchTest?name=world' | 'text/plain' | 'text/plain' | 'world'
+ 'POST' | '/mismatchTest1' | 'text/plain' | 'text/plain' | '{"message":"Invoker not found","status":"404"}'
+ 'GET' | '/mismatchTest' | '' | '' | '{"message":"Request method \'GET\' not supported","status":"405"}'
+ 'POST' | '/mismatchTest' | 'application/json' | 'text/plain' | '{"message":"Content type \'application/json\' not supported","status":"415"}'
+ 'POST' | '/mismatchTest' | 'text/plain' | 'application/json' | '{"message":"Could not find acceptable representation","status":"406"}'
+ 'POST' | '/mismatchTest?name=earth' | 'text/plain' | 'text/plain' | '{"message":"Unsatisfied query parameter conditions","status":"400"}'
}
}
diff --git a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/rest/service/DemoService.java b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/rest/service/DemoService.java
index 8469f14080d..b9597f057a0 100644
--- a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/rest/service/DemoService.java
+++ b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/rest/service/DemoService.java
@@ -17,6 +17,7 @@
package org.apache.dubbo.rpc.protocol.tri.rest.service;
import org.apache.dubbo.common.stream.StreamObserver;
+import org.apache.dubbo.remoting.http12.HttpMethods;
import org.apache.dubbo.remoting.http12.rest.Mapping;
import org.apache.dubbo.remoting.http12.rest.Param;
import org.apache.dubbo.rpc.protocol.tri.rest.service.User.Group;
@@ -71,4 +72,7 @@ public interface DemoService {
@Mapping(produces = "text/plain")
String produceTest(String name);
+
+ @Mapping(method = HttpMethods.POST, consumes = "text/plain", produces = "text/plain", params = "name=world")
+ String mismatchTest(String name);
}
diff --git a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/rest/service/DemoServiceImpl.java b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/rest/service/DemoServiceImpl.java
index 767cd7e6840..b5575fdbae3 100644
--- a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/rest/service/DemoServiceImpl.java
+++ b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/rest/service/DemoServiceImpl.java
@@ -148,4 +148,9 @@ public void pbServerStream(HealthCheckRequest request, StreamObserverApache Dubbo Zookeeper Spring Boot Starter
- 3.8.3
+ 3.8.4
diff --git a/dubbo-spring-boot/dubbo-spring-boot-starters/observability/pom.xml b/dubbo-spring-boot/dubbo-spring-boot-starters/observability/pom.xml
index b93000f5dca..b44be18956c 100644
--- a/dubbo-spring-boot/dubbo-spring-boot-starters/observability/pom.xml
+++ b/dubbo-spring-boot/dubbo-spring-boot-starters/observability/pom.xml
@@ -36,10 +36,10 @@
- 1.13.3
- 1.3.3
+ 1.13.4
+ 1.3.4
1.42.0
- 3.4.0
+ 3.4.2
0.16.0