@Test void serialize() { ExtendedURL extendedURL = new ExtendedURL(Arrays.asList("one", "with/slash", "with space")); assertEquals("/one/with%2Fslash/with+space", extendedURL.serialize()); assertEquals("/one/with%2Fslash/with+space", extendedURL.toString()); Map<String, List<String>> parameters = new LinkedHashMap<>(); parameters.put("key1", Arrays.asList("value1")); parameters.put("key2", Arrays.asList("value2", "value3")); extendedURL = new ExtendedURL(Arrays.asList("one", "with/slash", "with space"), parameters); assertEquals("/one/with%2Fslash/with+space?key1=value1&key2=value2&key2=value3", extendedURL.serialize()); }
public String serialize() { StringBuilder builder = new StringBuilder(); List<String> encodedSegments = new ArrayList<>(); for (String path : getSegments()) { encodedSegments.add(encodeSegment(path)); } builder.append(URL_SEPARATOR); builder.append(StringUtils.join(encodedSegments, URL_SEPARATOR)); Map<String, List<String>> uriParameters = getParameters(); if (!uriParameters.isEmpty()) { builder.append('?'); builder.append(this.escapeTool.url(uriParameters)); } return builder.toString(); }
ExtendedURL implements Cloneable { public String serialize() { StringBuilder builder = new StringBuilder(); List<String> encodedSegments = new ArrayList<>(); for (String path : getSegments()) { encodedSegments.add(encodeSegment(path)); } builder.append(URL_SEPARATOR); builder.append(StringUtils.join(encodedSegments, URL_SEPARATOR)); Map<String, List<String>> uriParameters = getParameters(); if (!uriParameters.isEmpty()) { builder.append('?'); builder.append(this.escapeTool.url(uriParameters)); } return builder.toString(); } }
ExtendedURL implements Cloneable { public String serialize() { StringBuilder builder = new StringBuilder(); List<String> encodedSegments = new ArrayList<>(); for (String path : getSegments()) { encodedSegments.add(encodeSegment(path)); } builder.append(URL_SEPARATOR); builder.append(StringUtils.join(encodedSegments, URL_SEPARATOR)); Map<String, List<String>> uriParameters = getParameters(); if (!uriParameters.isEmpty()) { builder.append('?'); builder.append(this.escapeTool.url(uriParameters)); } return builder.toString(); } ExtendedURL(List<String> segments);  ExtendedURL(List<String> segments, Map<String, List<String>> parameters);  ExtendedURL(URL url, String ignorePrefix); }
ExtendedURL implements Cloneable { public String serialize() { StringBuilder builder = new StringBuilder(); List<String> encodedSegments = new ArrayList<>(); for (String path : getSegments()) { encodedSegments.add(encodeSegment(path)); } builder.append(URL_SEPARATOR); builder.append(StringUtils.join(encodedSegments, URL_SEPARATOR)); Map<String, List<String>> uriParameters = getParameters(); if (!uriParameters.isEmpty()) { builder.append('?'); builder.append(this.escapeTool.url(uriParameters)); } return builder.toString(); } 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 { public String serialize() { StringBuilder builder = new StringBuilder(); List<String> encodedSegments = new ArrayList<>(); for (String path : getSegments()) { encodedSegments.add(encodeSegment(path)); } builder.append(URL_SEPARATOR); builder.append(StringUtils.join(encodedSegments, URL_SEPARATOR)); Map<String, List<String>> uriParameters = getParameters(); if (!uriParameters.isEmpty()) { builder.append('?'); builder.append(this.escapeTool.url(uriParameters)); } return builder.toString(); } 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();  }