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);