@Test public void testParseUrls() { String addresses = "192.168.0.1|192.168.0.2|192.168.0.3"; Map<String, String> parameters = new HashMap<String, String>(); parameters.put("username", "root"); parameters.put("password", "alibaba"); parameters.put("port", "10000"); parameters.put("protocol", "dubbo"); List<URL> urls = UrlUtils.parseURLs(addresses, parameters); assertEquals("192.168.0.1" + ":10000", urls.get(0).getAddress()); assertEquals("192.168.0.2" + ":10000", urls.get(1).getAddress()); }
public static List<URL> parseURLs(String address, Map<String, String> defaults) { if (address == null || address.length() == 0) { return null; } String[] addresses = Constants.REGISTRY_SPLIT_PATTERN.split(address); if (addresses == null || addresses.length == 0) { return null; } List<URL> registries = new ArrayList<URL>(); for (String addr : addresses) { registries.add(parseURL(addr, defaults)); } return registries; }
UrlUtils { public static List<URL> parseURLs(String address, Map<String, String> defaults) { if (address == null || address.length() == 0) { return null; } String[] addresses = Constants.REGISTRY_SPLIT_PATTERN.split(address); if (addresses == null || addresses.length == 0) { return null; } List<URL> registries = new ArrayList<URL>(); for (String addr : addresses) { registries.add(parseURL(addr, defaults)); } return registries; } }
UrlUtils { public static List<URL> parseURLs(String address, Map<String, String> defaults) { if (address == null || address.length() == 0) { return null; } String[] addresses = Constants.REGISTRY_SPLIT_PATTERN.split(address); if (addresses == null || addresses.length == 0) { return null; } List<URL> registries = new ArrayList<URL>(); for (String addr : addresses) { registries.add(parseURL(addr, defaults)); } return registries; }  }
UrlUtils { public static List<URL> parseURLs(String address, Map<String, String> defaults) { if (address == null || address.length() == 0) { return null; } String[] addresses = Constants.REGISTRY_SPLIT_PATTERN.split(address); if (addresses == null || addresses.length == 0) { return null; } List<URL> registries = new ArrayList<URL>(); for (String addr : addresses) { registries.add(parseURL(addr, defaults)); } return registries; }  static URL parseURL(String address, Map<String, String> defaults); static List<URL> parseURLs(String address, Map<String, String> defaults); static Map<String, Map<String, String>> convertRegister(Map<String, Map<String, String>> register); static Map<String, String> convertSubscribe(Map<String, String> subscribe); static Map<String, Map<String, String>> revertRegister(Map<String, Map<String, String>> register); static Map<String, String> revertSubscribe(Map<String, String> subscribe); static Map<String, Map<String, String>> revertNotify(Map<String, Map<String, String>> notify); static List<String> revertForbid(List<String> forbid, Set<URL> subscribed); static URL getEmptyUrl(String service, String category); static boolean isMatchCategory(String category, String categories); static boolean isMatch(URL consumerUrl, URL providerUrl); static boolean isMatchGlobPattern(String pattern, String value, URL param); static boolean isMatchGlobPattern(String pattern, String value); static boolean isServiceKeyMatch(URL pattern, URL value); }
UrlUtils { public static List<URL> parseURLs(String address, Map<String, String> defaults) { if (address == null || address.length() == 0) { return null; } String[] addresses = Constants.REGISTRY_SPLIT_PATTERN.split(address); if (addresses == null || addresses.length == 0) { return null; } List<URL> registries = new ArrayList<URL>(); for (String addr : addresses) { registries.add(parseURL(addr, defaults)); } return registries; }  static URL parseURL(String address, Map<String, String> defaults); static List<URL> parseURLs(String address, Map<String, String> defaults); static Map<String, Map<String, String>> convertRegister(Map<String, Map<String, String>> register); static Map<String, String> convertSubscribe(Map<String, String> subscribe); static Map<String, Map<String, String>> revertRegister(Map<String, Map<String, String>> register); static Map<String, String> revertSubscribe(Map<String, String> subscribe); static Map<String, Map<String, String>> revertNotify(Map<String, Map<String, String>> notify); static List<String> revertForbid(List<String> forbid, Set<URL> subscribed); static URL getEmptyUrl(String service, String category); static boolean isMatchCategory(String category, String categories); static boolean isMatch(URL consumerUrl, URL providerUrl); static boolean isMatchGlobPattern(String pattern, String value, URL param); static boolean isMatchGlobPattern(String pattern, String value); static boolean isServiceKeyMatch(URL pattern, URL value);  }