This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new 05b3dde Fix UnrecognizedPropertyException for jsonrpc (#7704)
05b3dde is described below
commit 05b3dde408897783544085af791da959af10cd30
Author: klzami <[email protected]>
AuthorDate: Thu May 13 11:42:56 2021 +0800
Fix UnrecognizedPropertyException for jsonrpc (#7704)
---
.../java/org/apache/dubbo/rpc/protocol/http/HttpProtocol.java | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git
a/dubbo-rpc/dubbo-rpc-http/src/main/java/org/apache/dubbo/rpc/protocol/http/HttpProtocol.java
b/dubbo-rpc/dubbo-rpc-http/src/main/java/org/apache/dubbo/rpc/protocol/http/HttpProtocol.java
index 53d8ab0..22d4434 100644
---
a/dubbo-rpc/dubbo-rpc-http/src/main/java/org/apache/dubbo/rpc/protocol/http/HttpProtocol.java
+++
b/dubbo-rpc/dubbo-rpc-http/src/main/java/org/apache/dubbo/rpc/protocol/http/HttpProtocol.java
@@ -31,6 +31,8 @@ import com.googlecode.jsonrpc4j.JsonRpcServer;
import com.googlecode.jsonrpc4j.spring.JsonProxyFactoryBean;
import org.apache.dubbo.rpc.service.GenericService;
import org.apache.dubbo.rpc.support.ProtocolUtils;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.remoting.RemoteAccessException;
import org.springframework.remoting.support.RemoteInvocation;
@@ -112,8 +114,10 @@ public class HttpProtocol extends AbstractProxyProtocol {
}
final String path = url.getAbsolutePath();
final String genericPath = path + "/" + GENERIC_KEY;
- JsonRpcServer skeleton = new JsonRpcServer(impl, type);
- JsonRpcServer genericServer = new JsonRpcServer(impl,
GenericService.class);
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,
false);
+ JsonRpcServer skeleton = new JsonRpcServer(mapper, impl, type);
+ JsonRpcServer genericServer = new JsonRpcServer(mapper, impl,
GenericService.class);
skeletonMap.put(path, skeleton);
skeletonMap.put(genericPath, genericServer);
return () -> {
@@ -188,4 +192,4 @@ public class HttpProtocol extends AbstractProxyProtocol {
}
-}
\ No newline at end of file
+}