Fix UnrecognizedPropertyException for jsonrpc (#7704)

This commit is contained in:
klzami 2021-05-13 11:42:56 +08:00 committed by GitHub
parent 9633f6b976
commit 05b3dde408
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -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 {
}
}
}