DispatchCriteriaHelper { public static String extractParamsFromURI(String uri){ if (uri.contains("?") && uri.contains("=")){ String parameters = uri.substring(uri.indexOf("?") + 1); StringBuilder params = new StringBuilder(); for (String parameter : parameters.split("&")){ String[] pair = parameter.split("="); try { String key = URLDecoder.decode(pair[0], "UTF-8"); String value = URLDecoder.decode(pair[1], "UTF-8"); if (params.length() > 0) { params.append(" && "); } params.append(key); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } return params.toString(); } return ""; }  static String extractParamsFromURI(String uri); static String extractCommonPrefix(List<String> uris); static String extractCommonSuffix(List<String> uris); static String extractPartsFromURIs(List<String> uris); static String extractPartsFromURIPattern(String pattern); static String extractFromURIPattern(String pattern, String realURI); static String buildFromPartsMap(Map<String, String> partsMap); static String buildFromParamsMap(String paramsRule, Map<String, String> paramsMap); static String extractFromURIParams(String paramsRule, String uri);  }
@Test public void testExtractParamsFromURI(){ String requestPath = "/v2/pet/findByStatus?user_key=998bac0775b1d5f588e0a6ca7c11b852&status=available"; String dispatchCriteria = DispatchCriteriaHelper.extractParamsFromURI(requestPath); assertEquals("user_key && status", dispatchCriteria); }