public static String getQueryStringValue(String qs, String key) { Map<String, String> map = StringUtils.parseQueryString(qs); return map.get(key); }
public static String getQueryStringValue(String qs, String key) { Map<String, String> map = StringUtils.parseQueryString(qs); return map.get(key); }
public static Parameters parseParameters(String query) { return new Parameters(StringUtils.parseQueryString(query)); }
public static Parameters parseParameters(String query) { return new Parameters(StringUtils.parseQueryString(query)); }
public static Map<String, String> revertSubscribe(Map<String, String> subscribe) { Map<String, String> newSubscribe = new HashMap<String, String>(); for (Map.Entry<String, String> entry : subscribe.entrySet()) { String serviceName = entry.getKey(); String serviceQuery = entry.getValue(); if (serviceName.contains(":") || serviceName.contains("/")) { Map<String, String> params = StringUtils.parseQueryString(serviceQuery); String name = serviceName; int i = name.indexOf('/'); if (i >= 0) { params.put("group", name.substring(0, i)); name = name.substring(i + 1); } i = name.lastIndexOf(':'); if (i >= 0) { params.put("version", name.substring(i + 1)); name = name.substring(0, i); } newSubscribe.put(name, StringUtils.toQueryString(params)); } else { newSubscribe.put(serviceName, serviceQuery); } } return newSubscribe; }
public static Map<String, String> convertSubscribe(Map<String, String> subscribe) { Map<String, String> newSubscribe = new HashMap<String, String>(); for (Map.Entry<String, String> entry : subscribe.entrySet()) { String serviceName = entry.getKey(); String serviceQuery = entry.getValue(); if (!serviceName.contains(":") && !serviceName.contains("/")) { Map<String, String> params = StringUtils.parseQueryString(serviceQuery); String group = params.get("group"); String version = params.get("version"); //params.remove("group"); //params.remove("version"); String name = serviceName; if (group != null && group.length() > 0) { name = group + "/" + name; } if (version != null && version.length() > 0) { name = name + ":" + version; } newSubscribe.put(name, StringUtils.toQueryString(params)); } else { newSubscribe.put(serviceName, serviceQuery); } } return newSubscribe; }
public static Map<String, String> convertSubscribe(Map<String, String> subscribe) { Map<String, String> newSubscribe = new HashMap<String, String>(); for (Map.Entry<String, String> entry : subscribe.entrySet()) { String serviceName = entry.getKey(); String serviceQuery = entry.getValue(); if (!serviceName.contains(":") && !serviceName.contains("/")) { Map<String, String> params = StringUtils.parseQueryString(serviceQuery); String group = params.get("group"); String version = params.get("version"); //params.remove("group"); //params.remove("version"); String name = serviceName; if (group != null && group.length() > 0) { name = group + "/" + name; } if (version != null && version.length() > 0) { name = name + ":" + version; } newSubscribe.put(name, StringUtils.toQueryString(params)); } else { newSubscribe.put(serviceName, serviceQuery); } } return newSubscribe; }
public static Map<String, String> revertSubscribe(Map<String, String> subscribe) { Map<String, String> newSubscribe = new HashMap<String, String>(); for (Map.Entry<String, String> entry : subscribe.entrySet()) { String serviceName = entry.getKey(); String serviceQuery = entry.getValue(); if (serviceName.contains(":") || serviceName.contains("/")) { Map<String, String> params = StringUtils.parseQueryString(serviceQuery); String name = serviceName; int i = name.indexOf('/'); if (i >= 0) { params.put("group", name.substring(0, i)); name = name.substring(i + 1); } i = name.lastIndexOf(':'); if (i >= 0) { params.put("version", name.substring(i + 1)); name = name.substring(0, i); } newSubscribe.put(name, StringUtils.toQueryString(params)); } else { newSubscribe.put(serviceName, serviceQuery); } } return newSubscribe; }
String serviceUrl = entry2.getKey(); String serviceQuery = entry2.getValue(); Map<String, String> params = StringUtils.parseQueryString(serviceQuery); String group = params.get("group"); String version = params.get("version");
public URL addParameterString(String query) { if (StringUtils.isEmpty(query)) { return this; } return addParameters(StringUtils.parseQueryString(query)); }
String serviceUrl = entry2.getKey(); String serviceQuery = entry2.getValue(); Map<String, String> params = StringUtils.parseQueryString(serviceQuery); String group = params.get("group"); String version = params.get("version");
String serviceUrl = entry2.getKey(); String serviceQuery = entry2.getValue(); Map<String, String> params = StringUtils.parseQueryString(serviceQuery); String name = serviceName; int i = name.indexOf('/');
public URL addParameterString(String query) { if (StringUtils.isEmpty(query)) { return this; } return addParameters(StringUtils.parseQueryString(query)); }
String serviceUrl = entry2.getKey(); String serviceQuery = entry2.getValue(); Map<String, String> params = StringUtils.parseQueryString(serviceQuery); String name = serviceName; int i = name.indexOf('/');
public RegistryDirectory(Class<T> serviceType, URL url) { super(url); if (serviceType == null) { throw new IllegalArgumentException("service type is null."); } if (url.getServiceKey() == null || url.getServiceKey().length() == 0) { throw new IllegalArgumentException("registry serviceKey is null."); } this.serviceType = serviceType; this.serviceKey = url.getServiceKey(); this.queryMap = StringUtils.parseQueryString(url.getParameterAndDecoded(Constants.REFER_KEY)); this.overrideDirectoryUrl = this.directoryUrl = turnRegistryUrlToConsumerUrl(url); String group = directoryUrl.getParameter(Constants.GROUP_KEY, ""); this.multiGroup = group != null && ("*".equals(group) || group.contains(",")); }
public RegistryDirectory(Class<T> serviceType, URL url) { super(url); if (serviceType == null) { throw new IllegalArgumentException("service type is null."); } if (url.getServiceKey() == null || url.getServiceKey().length() == 0) { throw new IllegalArgumentException("registry serviceKey is null."); } this.serviceType = serviceType; this.serviceKey = url.getServiceKey(); this.queryMap = StringUtils.parseQueryString(url.getParameterAndDecoded(Constants.REFER_KEY)); this.overrideDirectoryUrl = this.directoryUrl = turnRegistryUrlToConsumerUrl(url); String group = directoryUrl.getParameter(Constants.GROUP_KEY, ""); this.multiGroup = group != null && ("*".equals(group) || group.contains(",")); }
public AbstractDirectory(URL url, URL consumerUrl, RouterChain<T> routerChain) { if (url == null) { throw new IllegalArgumentException("url == null"); } if (url.getProtocol().equals(Constants.REGISTRY_PROTOCOL)) { Map<String, String> queryMap = StringUtils.parseQueryString(url.getParameterAndDecoded(Constants.REFER_KEY)); this.url = url.addParameters(queryMap).removeParameter(Constants.MONITOR_KEY); } else { this.url = url; } this.consumerUrl = consumerUrl; setRouterChain(routerChain); }
public AbstractDirectory(URL url, URL consumerUrl, RouterChain<T> routerChain) { if (url == null) { throw new IllegalArgumentException("url == null"); } if (url.getProtocol().equals(Constants.REGISTRY_PROTOCOL)) { Map<String, String> queryMap = StringUtils.parseQueryString(url.getParameterAndDecoded(Constants.REFER_KEY)); this.url = url.addParameters(queryMap).removeParameter(Constants.MONITOR_KEY); } else { this.url = url; } this.consumerUrl = consumerUrl; setRouterChain(routerChain); }
@Override @SuppressWarnings("unchecked") public <T> Invoker<T> refer(Class<T> type, URL url) throws RpcException { url = url.setProtocol(url.getParameter(REGISTRY_KEY, DEFAULT_REGISTRY)).removeParameter(REGISTRY_KEY); Registry registry = registryFactory.getRegistry(url); if (RegistryService.class.equals(type)) { return proxyFactory.getInvoker((T) registry, type, url); } // group="a,b" or group="*" Map<String, String> qs = StringUtils.parseQueryString(url.getParameterAndDecoded(REFER_KEY)); String group = qs.get(Constants.GROUP_KEY); if (group != null && group.length() > 0) { if ((COMMA_SPLIT_PATTERN.split(group)).length > 1 || "*".equals(group)) { return doRefer(getMergeableCluster(), registry, type, url); } } return doRefer(cluster, registry, type, url); }
@Override @SuppressWarnings("unchecked") public <T> Invoker<T> refer(Class<T> type, URL url) throws RpcException { url = url.setProtocol(url.getParameter(REGISTRY_KEY, DEFAULT_REGISTRY)).removeParameter(REGISTRY_KEY); Registry registry = registryFactory.getRegistry(url); if (RegistryService.class.equals(type)) { return proxyFactory.getInvoker((T) registry, type, url); } // group="a,b" or group="*" Map<String, String> qs = StringUtils.parseQueryString(url.getParameterAndDecoded(REFER_KEY)); String group = qs.get(Constants.GROUP_KEY); if (group != null && group.length() > 0) { if ((COMMA_SPLIT_PATTERN.split(group)).length > 1 || "*".equals(group)) { return doRefer(getMergeableCluster(), registry, type, url); } } return doRefer(cluster, registry, type, url); }