@Test public void testUnquoteURIPathComponent() { assertEquals("test yes:no /caf\u00e9.bin", uq("test%20yes%3Ano%20%2Fcaf%C3%A9.bin")); assertEquals("http: assertEquals("a/b/c", uq("a/b/c")); assertEquals("[foo] bar?", uq("%5Bfoo%5D%20bar%3F")); }
public static String unquoteURIPathComponent(String s) { if ("".equals(s)) { return s; } URI uri; try { uri = new URI("http: } catch (URISyntaxException e) { throw new IllegalArgumentException("Illegal characters in: " + s, e); } String path = uri.getPath(); if (path.startsWith("/") && !s.startsWith("/")) { path = path.substring(1); } return path; }
URIUtils { public static String unquoteURIPathComponent(String s) { if ("".equals(s)) { return s; } URI uri; try { uri = new URI("http: } catch (URISyntaxException e) { throw new IllegalArgumentException("Illegal characters in: " + s, e); } String path = uri.getPath(); if (path.startsWith("/") && !s.startsWith("/")) { path = path.substring(1); } return path; } }
URIUtils { public static String unquoteURIPathComponent(String s) { if ("".equals(s)) { return s; } URI uri; try { uri = new URI("http: } catch (URISyntaxException e) { throw new IllegalArgumentException("Illegal characters in: " + s, e); } String path = uri.getPath(); if (path.startsWith("/") && !s.startsWith("/")) { path = path.substring(1); } return path; } private  URIUtils(); }
URIUtils { public static String unquoteURIPathComponent(String s) { if ("".equals(s)) { return s; } URI uri; try { uri = new URI("http: } catch (URISyntaxException e) { throw new IllegalArgumentException("Illegal characters in: " + s, e); } String path = uri.getPath(); if (path.startsWith("/") && !s.startsWith("/")) { path = path.substring(1); } return path; } private  URIUtils(); static String getURIQuery(Map<String, String> parameters); static String getURIPath(String uri); static Map<String, String> getRequestParameters(String uriQuery); static String addParametersToURIQuery(String uriString, Map<String, String> parameters); static String quoteURIPathComponent(String s, boolean quoteSlash); static String quoteURIPathComponent(String s, boolean quoteSlash, boolean quoteAt); static String quoteURIPathToken(String s); static String unquoteURIPathComponent(String s); }
URIUtils { public static String unquoteURIPathComponent(String s) { if ("".equals(s)) { return s; } URI uri; try { uri = new URI("http: } catch (URISyntaxException e) { throw new IllegalArgumentException("Illegal characters in: " + s, e); } String path = uri.getPath(); if (path.startsWith("/") && !s.startsWith("/")) { path = path.substring(1); } return path; } private  URIUtils(); static String getURIQuery(Map<String, String> parameters); static String getURIPath(String uri); static Map<String, String> getRequestParameters(String uriQuery); static String addParametersToURIQuery(String uriString, Map<String, String> parameters); static String quoteURIPathComponent(String s, boolean quoteSlash); static String quoteURIPathComponent(String s, boolean quoteSlash, boolean quoteAt); static String quoteURIPathToken(String s); static String unquoteURIPathComponent(String s);  }