From 08b920ed190bcd7226709857545b6e73ff99789a Mon Sep 17 00:00:00 2001 From: huangsimin Date: Tue, 9 Jul 2019 13:45:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=AF=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../biz/filters/bean/GenericServicePool.java | 4 --- .../service/usergw/config/ConfigGateway.java | 29 +++++-------------- 2 files changed, 7 insertions(+), 26 deletions(-) diff --git a/usergw-service/src/main/java/cn/ecpark/service/usergw/biz/filters/bean/GenericServicePool.java b/usergw-service/src/main/java/cn/ecpark/service/usergw/biz/filters/bean/GenericServicePool.java index 9d65a58..8d990ee 100644 --- a/usergw-service/src/main/java/cn/ecpark/service/usergw/biz/filters/bean/GenericServicePool.java +++ b/usergw-service/src/main/java/cn/ecpark/service/usergw/biz/filters/bean/GenericServicePool.java @@ -24,8 +24,4 @@ public class GenericServicePool { public void put(String key, GenericService genericService) { gsDictionary.put(key, genericService); } - - // public boolean contains(String key) { - // return gsDictionary.containsKey(key); - // } } \ No newline at end of file diff --git a/usergw-service/src/main/java/cn/ecpark/service/usergw/config/ConfigGateway.java b/usergw-service/src/main/java/cn/ecpark/service/usergw/config/ConfigGateway.java index befc65f..735be17 100644 --- a/usergw-service/src/main/java/cn/ecpark/service/usergw/config/ConfigGateway.java +++ b/usergw-service/src/main/java/cn/ecpark/service/usergw/config/ConfigGateway.java @@ -75,20 +75,6 @@ public class ConfigGateway implements RouteDefinitionLocator { Map configYaml = new Yaml().load((InputStream) inputStream); if (configYaml != null) { - // streaming-media-types 这个先不管 - // NettyWriteResponseFilter nwrf = - // applicationContext.getBean(NettyWriteResponseFilter.class); - // try { - // Field field = nwrf.getClass().getDeclaredField("streamingMediaTypes"); - // field.setAccessible(true); - // List mts = new ArrayList(); - // mts.add(MediaType.TEXT_EVENT_STREAM); - // mts.add(MediaType.APPLICATION_STREAM_JSON); - // field.set(nwrf, mts); - // } catch (Exception e) { - // log.error(e.toString()); - // } - Map defaultYaml = (Map) configYaml.get("restful"); Map dubboYaml = (Map) configYaml.get("dubbo"); @@ -111,7 +97,6 @@ public class ConfigGateway implements RouteDefinitionLocator { } return Flux.empty(); - // return Flux.fromIterable(it); } @@ -223,6 +208,7 @@ public class ConfigGateway implements RouteDefinitionLocator { } } + @SuppressWarnings("unchecked") private String parseDubboUriAndSetBase(RouteDefinition rd, LinkedHashMap> iter) { // 设置id Object id = iter.get("id"); @@ -252,13 +238,6 @@ public class ConfigGateway implements RouteDefinitionLocator { } iter.remove("order"); - if (uri != null) { - String uriString = (String) uri; - uriString = uriString.trim(); - if (uriString.startsWith("dubbo://")) { // dubbo://127.0.0.1/interface? - return uriString; - } - } ReferenceConfig reference = new ReferenceConfig(); reference.setConnections(3); @@ -273,6 +252,7 @@ public class ConfigGateway implements RouteDefinitionLocator { } iter.remove("application"); + // 遍历所有dubbo配置的key, 如果不存在特殊处理的, 就直接反射到reference 默认方法上 for (Entry> entry : iter.entrySet()) { // Object group = iter.get("group"); String key = entry.getKey(); @@ -297,6 +277,11 @@ public class ConfigGateway implements RouteDefinitionLocator { } } + // Object methods = iter.get("methods"); + // if(methods == null || ((List)methods).size() == 0) { + // DubboGatewayFilterFactory.mehtods.put(name, params); + // } + UriString += Extract.getReferenceConfigKey(reference); GenericServicePool gsPool = appContext.getBean(GenericServicePool.class); reference.setGeneric(true);