XUrl { public static String path(String url) { Preconditions.checkNotNull(url); url = addProtocol(url); try { return new URI(url).getPath(); } catch (URISyntaxException e) { log.info("Malformed url: {}", url); return null; } }  static String host(String url); static int port(String url); static String domainChecked(String url); static String path(String url); static String stripUrlParameters(String url); static String stripUrlParameters(URL url); static String rawQueryParameters(String url); static String addProtocol(String url); static Map<String, List<String>> decodeQueryString(String url); static InetSocketAddress inetSocket(String url);  }
@Test void getPath() { assertEquals("/foo/v1", XUrl.path(url1)); }
@Test void getPath_withUrlEncoding() { String path = XUrl.path("https: assertEquals("/foo/bar baz", path); }