@Test public void testReplaceWeight() throws Exception { assertEquals( "dubbo: ParseUtils.replaceParameter("dubbo: assertEquals( "dubbo: ParseUtils.replaceParameter("dubbo: assertEquals( "dubbo: ParseUtils.replaceParameter("dubbo: }
public static String replaceParameter(String query, String key, String value) { if (query == null || query.length() == 0) { return key + "=" + value; } if (query.indexOf(key + "=") == -1) { return query + "&" + key + "=" + value; } Pattern pattern = REPLACE_PARAMETER_PATTERNS.get(key); if (pattern == null) { pattern = Pattern.compile(key.replaceAll("([^(_0-9A-Za-z)])", "\\\\$0") + "=[^&]+"); } Matcher matcher = pattern.matcher(query); StringBuffer sb = new StringBuffer(); while (matcher.find()) { matcher.appendReplacement(sb, (key + "=" + value).replace("$", "\\$")); } matcher.appendTail(sb); return sb.toString(); }
ParseUtils { public static String replaceParameter(String query, String key, String value) { if (query == null || query.length() == 0) { return key + "=" + value; } if (query.indexOf(key + "=") == -1) { return query + "&" + key + "=" + value; } Pattern pattern = REPLACE_PARAMETER_PATTERNS.get(key); if (pattern == null) { pattern = Pattern.compile(key.replaceAll("([^(_0-9A-Za-z)])", "\\\\$0") + "=[^&]+"); } Matcher matcher = pattern.matcher(query); StringBuffer sb = new StringBuffer(); while (matcher.find()) { matcher.appendReplacement(sb, (key + "=" + value).replace("$", "\\$")); } matcher.appendTail(sb); return sb.toString(); } }
ParseUtils { public static String replaceParameter(String query, String key, String value) { if (query == null || query.length() == 0) { return key + "=" + value; } if (query.indexOf(key + "=") == -1) { return query + "&" + key + "=" + value; } Pattern pattern = REPLACE_PARAMETER_PATTERNS.get(key); if (pattern == null) { pattern = Pattern.compile(key.replaceAll("([^(_0-9A-Za-z)])", "\\\\$0") + "=[^&]+"); } Matcher matcher = pattern.matcher(query); StringBuffer sb = new StringBuffer(); while (matcher.find()) { matcher.appendReplacement(sb, (key + "=" + value).replace("$", "\\$")); } matcher.appendTail(sb); return sb.toString(); } private  ParseUtils(); }
ParseUtils { public static String replaceParameter(String query, String key, String value) { if (query == null || query.length() == 0) { return key + "=" + value; } if (query.indexOf(key + "=") == -1) { return query + "&" + key + "=" + value; } Pattern pattern = REPLACE_PARAMETER_PATTERNS.get(key); if (pattern == null) { pattern = Pattern.compile(key.replaceAll("([^(_0-9A-Za-z)])", "\\\\$0") + "=[^&]+"); } Matcher matcher = pattern.matcher(query); StringBuffer sb = new StringBuffer(); while (matcher.find()) { matcher.appendReplacement(sb, (key + "=" + value).replace("$", "\\$")); } matcher.appendTail(sb); return sb.toString(); } private  ParseUtils(); static String interpolate(String expression, Map<String, String> params); static List<String> interpolate(List<String> expressions, Map<String, String> params); static boolean isMatchGlobPattern(String pattern, String value); static boolean isMatchGlobPatternsNeedInterpolate(
            Collection<String> patternsNeedInterpolate,
            Map<String, String> interpolateParams, String value); static Set<String> filterByGlobPattern(String pattern, Collection<String> values); static Set<String> filterByGlobPattern(Collection<String> patterns, Collection<String> values); static boolean hasIntersection(String glob1, String glob2); static Map<String, String> parseQuery(String keyPrefix, String query); static Map<String, String> parseQuery(String query); static String replaceParameter(String query, String key, String value); static String appendParamToUri(String uri, String name, String value); static String appendParamsToUri(String uri, Map<String, String> params); static boolean matchEndStarPattern(String value, String pattern); }
ParseUtils { public static String replaceParameter(String query, String key, String value) { if (query == null || query.length() == 0) { return key + "=" + value; } if (query.indexOf(key + "=") == -1) { return query + "&" + key + "=" + value; } Pattern pattern = REPLACE_PARAMETER_PATTERNS.get(key); if (pattern == null) { pattern = Pattern.compile(key.replaceAll("([^(_0-9A-Za-z)])", "\\\\$0") + "=[^&]+"); } Matcher matcher = pattern.matcher(query); StringBuffer sb = new StringBuffer(); while (matcher.find()) { matcher.appendReplacement(sb, (key + "=" + value).replace("$", "\\$")); } matcher.appendTail(sb); return sb.toString(); } private  ParseUtils(); static String interpolate(String expression, Map<String, String> params); static List<String> interpolate(List<String> expressions, Map<String, String> params); static boolean isMatchGlobPattern(String pattern, String value); static boolean isMatchGlobPatternsNeedInterpolate(
            Collection<String> patternsNeedInterpolate,
            Map<String, String> interpolateParams, String value); static Set<String> filterByGlobPattern(String pattern, Collection<String> values); static Set<String> filterByGlobPattern(Collection<String> patterns, Collection<String> values); static boolean hasIntersection(String glob1, String glob2); static Map<String, String> parseQuery(String keyPrefix, String query); static Map<String, String> parseQuery(String query); static String replaceParameter(String query, String key, String value); static String appendParamToUri(String uri, String name, String value); static String appendParamsToUri(String uri, Map<String, String> params); static boolean matchEndStarPattern(String value, String pattern); static String METHOD_SPLIT; }