@Test void extractParameters() throws Exception { URL url = new URL("http: ExtendedURL extendedURL = new ExtendedURL(url, null); Map<String, List<String>> parameters = extendedURL.extractParameters(url.toURI()); assertThat(parameters, hasEntry(is("foo"), hasItems("bar", "baz"))); assertThat(parameters, hasEntry(is("toto"), is(empty()))); }
protected Map<String, List<String>> extractParameters(URI uri) { Map<String, List<String>> uriParameters; if (uri.getQuery() != null) { uriParameters = new LinkedHashMap<>(); for (String nameValue : Arrays.asList(uri.getQuery().split("&"))) { String[] pair = nameValue.split("=", 2); if (pair.length == 2) { addParameter(pair[0], pair[1], uriParameters); } else { addParameter(pair[0], null, uriParameters); } } } else { uriParameters = Collections.emptyMap(); } return uriParameters; }
ExtendedURL implements Cloneable { protected Map<String, List<String>> extractParameters(URI uri) { Map<String, List<String>> uriParameters; if (uri.getQuery() != null) { uriParameters = new LinkedHashMap<>(); for (String nameValue : Arrays.asList(uri.getQuery().split("&"))) { String[] pair = nameValue.split("=", 2); if (pair.length == 2) { addParameter(pair[0], pair[1], uriParameters); } else { addParameter(pair[0], null, uriParameters); } } } else { uriParameters = Collections.emptyMap(); } return uriParameters; } }
ExtendedURL implements Cloneable { protected Map<String, List<String>> extractParameters(URI uri) { Map<String, List<String>> uriParameters; if (uri.getQuery() != null) { uriParameters = new LinkedHashMap<>(); for (String nameValue : Arrays.asList(uri.getQuery().split("&"))) { String[] pair = nameValue.split("=", 2); if (pair.length == 2) { addParameter(pair[0], pair[1], uriParameters); } else { addParameter(pair[0], null, uriParameters); } } } else { uriParameters = Collections.emptyMap(); } return uriParameters; } ExtendedURL(List<String> segments);  ExtendedURL(List<String> segments, Map<String, List<String>> parameters);  ExtendedURL(URL url, String ignorePrefix); }
ExtendedURL implements Cloneable { protected Map<String, List<String>> extractParameters(URI uri) { Map<String, List<String>> uriParameters; if (uri.getQuery() != null) { uriParameters = new LinkedHashMap<>(); for (String nameValue : Arrays.asList(uri.getQuery().split("&"))) { String[] pair = nameValue.split("=", 2); if (pair.length == 2) { addParameter(pair[0], pair[1], uriParameters); } else { addParameter(pair[0], null, uriParameters); } } } else { uriParameters = Collections.emptyMap(); } return uriParameters; } ExtendedURL(List<String> segments);  ExtendedURL(List<String> segments, Map<String, List<String>> parameters);  ExtendedURL(URL url, String ignorePrefix); List<String> getSegments(); URL getWrappedURL(); URI getURI(); Map<String, List<String>> getParameters(); @Override int hashCode(); @Override boolean equals(Object object); String serialize(); @Override String toString(); }
ExtendedURL implements Cloneable { protected Map<String, List<String>> extractParameters(URI uri) { Map<String, List<String>> uriParameters; if (uri.getQuery() != null) { uriParameters = new LinkedHashMap<>(); for (String nameValue : Arrays.asList(uri.getQuery().split("&"))) { String[] pair = nameValue.split("=", 2); if (pair.length == 2) { addParameter(pair[0], pair[1], uriParameters); } else { addParameter(pair[0], null, uriParameters); } } } else { uriParameters = Collections.emptyMap(); } return uriParameters; } ExtendedURL(List<String> segments);  ExtendedURL(List<String> segments, Map<String, List<String>> parameters);  ExtendedURL(URL url, String ignorePrefix); List<String> getSegments(); URL getWrappedURL(); URI getURI(); Map<String, List<String>> getParameters(); @Override int hashCode(); @Override boolean equals(Object object); String serialize(); @Override String toString();  }