完成自动Dubbo GenericService设置参数

This commit is contained in:
eson 2019-07-09 01:31:26 +08:00
parent 8624659273
commit dba005c31b

View File

@ -58,33 +58,32 @@ public class DubboGatewayFilterFactory extends AbstractGatewayFilterFactory<Dubb
GenericServicePool gsPool = appContext.getBean(GenericServicePool.class);
GenericService gs = gsPool.get(uri);
ServerHttpRequest req = exchange.getRequest();
Flux<DataBuffer> body = req.getBody();
HttpMethod m = req.getMethod();
MultiValueMap<String, String> queryParams = req.getQueryParams();
body.map( buffer -> {
byte[] bytes = new byte[buffer.readableByteCount()];
buffer.read(bytes);
DataBufferUtils.release(buffer);
try {
String bodyString = new String(bytes, "utf-8");
log.error("test body");
} catch (Exception e) {
e.printStackTrace();
}
});
// body.map( buffer -> {
// byte[] bytes = new byte[buffer.readableByteCount()];
// buffer.read(bytes);
// DataBufferUtils.release(buffer);
// try {
// String bodyString = new String(bytes, "utf-8");
// log.error("test body");
// } catch (Exception e) {
// e.printStackTrace();
// }
// return Flux.just(bytes);
// });
List<String> methodString = queryParams.get("method");
List<String> params = queryParams.get("params");
if(methodString.size() != 0) {
// special
Object result = gs.$invoke(methodString.get(0), new String[] { "java.lang.String" }, new Object[] { "222" });
// gsPool.add(rkey, gs);
List<String> paramTypes = mehtods.get(methodString.get(0));
Object result = gs.$invoke(methodString.get(0), Arrays.copyOf(paramTypes.toArray(), paramTypes.size(), String[].class), params.toArray());
if (result != null) {
ServerHttpResponse response = exchange.getResponse();
return response.writeWith(Mono