可测试
This commit is contained in:
parent
01a175cfaa
commit
08b920ed19
|
@ -24,8 +24,4 @@ public class GenericServicePool {
|
||||||
public void put(String key, GenericService genericService) {
|
public void put(String key, GenericService genericService) {
|
||||||
gsDictionary.put(key, genericService);
|
gsDictionary.put(key, genericService);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public boolean contains(String key) {
|
|
||||||
// return gsDictionary.containsKey(key);
|
|
||||||
// }
|
|
||||||
}
|
}
|
|
@ -75,20 +75,6 @@ public class ConfigGateway implements RouteDefinitionLocator {
|
||||||
Map<String, Object> configYaml = new Yaml().load((InputStream) inputStream);
|
Map<String, Object> configYaml = new Yaml().load((InputStream) inputStream);
|
||||||
if (configYaml != null) {
|
if (configYaml != null) {
|
||||||
|
|
||||||
// streaming-media-types 这个先不管
|
|
||||||
// NettyWriteResponseFilter nwrf =
|
|
||||||
// applicationContext.getBean(NettyWriteResponseFilter.class);
|
|
||||||
// try {
|
|
||||||
// Field field = nwrf.getClass().getDeclaredField("streamingMediaTypes");
|
|
||||||
// field.setAccessible(true);
|
|
||||||
// List<MediaType> mts = new ArrayList<MediaType>();
|
|
||||||
// mts.add(MediaType.TEXT_EVENT_STREAM);
|
|
||||||
// mts.add(MediaType.APPLICATION_STREAM_JSON);
|
|
||||||
// field.set(nwrf, mts);
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// log.error(e.toString());
|
|
||||||
// }
|
|
||||||
|
|
||||||
Map<String, Object> defaultYaml = (Map<String, Object>) configYaml.get("restful");
|
Map<String, Object> defaultYaml = (Map<String, Object>) configYaml.get("restful");
|
||||||
Map<String, Object> dubboYaml = (Map<String, Object>) configYaml.get("dubbo");
|
Map<String, Object> dubboYaml = (Map<String, Object>) configYaml.get("dubbo");
|
||||||
|
|
||||||
|
@ -111,7 +97,6 @@ public class ConfigGateway implements RouteDefinitionLocator {
|
||||||
}
|
}
|
||||||
|
|
||||||
return Flux.empty();
|
return Flux.empty();
|
||||||
// return Flux.fromIterable(it);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -223,6 +208,7 @@ public class ConfigGateway implements RouteDefinitionLocator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
private String parseDubboUriAndSetBase(RouteDefinition rd, LinkedHashMap<String, List<String>> iter) {
|
private String parseDubboUriAndSetBase(RouteDefinition rd, LinkedHashMap<String, List<String>> iter) {
|
||||||
// 设置id
|
// 设置id
|
||||||
Object id = iter.get("id");
|
Object id = iter.get("id");
|
||||||
|
@ -252,13 +238,6 @@ public class ConfigGateway implements RouteDefinitionLocator {
|
||||||
}
|
}
|
||||||
iter.remove("order");
|
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<GenericService> reference = new ReferenceConfig<GenericService>();
|
ReferenceConfig<GenericService> reference = new ReferenceConfig<GenericService>();
|
||||||
reference.setConnections(3);
|
reference.setConnections(3);
|
||||||
|
@ -273,6 +252,7 @@ public class ConfigGateway implements RouteDefinitionLocator {
|
||||||
}
|
}
|
||||||
iter.remove("application");
|
iter.remove("application");
|
||||||
|
|
||||||
|
// 遍历所有dubbo配置的key, 如果不存在特殊处理的, 就直接反射到reference 默认方法上
|
||||||
for (Entry<String, List<String>> entry : iter.entrySet()) {
|
for (Entry<String, List<String>> entry : iter.entrySet()) {
|
||||||
// Object group = iter.get("group");
|
// Object group = iter.get("group");
|
||||||
String key = entry.getKey();
|
String key = entry.getKey();
|
||||||
|
@ -297,6 +277,11 @@ public class ConfigGateway implements RouteDefinitionLocator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Object methods = iter.get("methods");
|
||||||
|
// if(methods == null || ((List<Object>)methods).size() == 0) {
|
||||||
|
// DubboGatewayFilterFactory.mehtods.put(name, params);
|
||||||
|
// }
|
||||||
|
|
||||||
UriString += Extract.getReferenceConfigKey(reference);
|
UriString += Extract.getReferenceConfigKey(reference);
|
||||||
GenericServicePool gsPool = appContext.getBean(GenericServicePool.class);
|
GenericServicePool gsPool = appContext.getBean(GenericServicePool.class);
|
||||||
reference.setGeneric(true);
|
reference.setGeneric(true);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user