@Test public void parseHandlesSlashesInBothDirections() { assertEquals(Urls.parse("http: }
@Nonnull public static Url parse(String url) { SplitUrl split = SplitUrl.split(Strings.sanitizeWhitespace(url)); if (split.urlType() != Type.FULL) { throw new IllegalArgumentException("URL must have a scheme and host. Eg: http: } UrlBuilder builder = new UrlBuilder(Scheme.valueOf(split.scheme()), split.authority()); if (!Strings.isNullOrEmpty(split.path())) { builder.path(Paths.parse(split.path())); } if (!Strings.isNullOrEmpty(split.query())) { builder.query(Queries.parse(split.query())); } if (!Strings.isNullOrEmpty(split.fragment())) { builder.fragment(PercentDecoder.decodeAll(split.fragment())); } return builder.create(); }
Urls { @Nonnull public static Url parse(String url) { SplitUrl split = SplitUrl.split(Strings.sanitizeWhitespace(url)); if (split.urlType() != Type.FULL) { throw new IllegalArgumentException("URL must have a scheme and host. Eg: http: } UrlBuilder builder = new UrlBuilder(Scheme.valueOf(split.scheme()), split.authority()); if (!Strings.isNullOrEmpty(split.path())) { builder.path(Paths.parse(split.path())); } if (!Strings.isNullOrEmpty(split.query())) { builder.query(Queries.parse(split.query())); } if (!Strings.isNullOrEmpty(split.fragment())) { builder.fragment(PercentDecoder.decodeAll(split.fragment())); } return builder.create(); } }
Urls { @Nonnull public static Url parse(String url) { SplitUrl split = SplitUrl.split(Strings.sanitizeWhitespace(url)); if (split.urlType() != Type.FULL) { throw new IllegalArgumentException("URL must have a scheme and host. Eg: http: } UrlBuilder builder = new UrlBuilder(Scheme.valueOf(split.scheme()), split.authority()); if (!Strings.isNullOrEmpty(split.path())) { builder.path(Paths.parse(split.path())); } if (!Strings.isNullOrEmpty(split.query())) { builder.query(Queries.parse(split.query())); } if (!Strings.isNullOrEmpty(split.fragment())) { builder.fragment(PercentDecoder.decodeAll(split.fragment())); } return builder.create(); } private  Urls(); }
Urls { @Nonnull public static Url parse(String url) { SplitUrl split = SplitUrl.split(Strings.sanitizeWhitespace(url)); if (split.urlType() != Type.FULL) { throw new IllegalArgumentException("URL must have a scheme and host. Eg: http: } UrlBuilder builder = new UrlBuilder(Scheme.valueOf(split.scheme()), split.authority()); if (!Strings.isNullOrEmpty(split.path())) { builder.path(Paths.parse(split.path())); } if (!Strings.isNullOrEmpty(split.query())) { builder.query(Queries.parse(split.query())); } if (!Strings.isNullOrEmpty(split.fragment())) { builder.fragment(PercentDecoder.decodeAll(split.fragment())); } return builder.create(); } private  Urls(); @Nonnull static URI createURI(@Nonnull String fullUrl); @Nonnull static String escape(@Nonnull String url); static UrlBuilder http(String host); static UrlBuilder https(String host); @Nonnull static Url parse(String url); }
Urls { @Nonnull public static Url parse(String url) { SplitUrl split = SplitUrl.split(Strings.sanitizeWhitespace(url)); if (split.urlType() != Type.FULL) { throw new IllegalArgumentException("URL must have a scheme and host. Eg: http: } UrlBuilder builder = new UrlBuilder(Scheme.valueOf(split.scheme()), split.authority()); if (!Strings.isNullOrEmpty(split.path())) { builder.path(Paths.parse(split.path())); } if (!Strings.isNullOrEmpty(split.query())) { builder.query(Queries.parse(split.query())); } if (!Strings.isNullOrEmpty(split.fragment())) { builder.fragment(PercentDecoder.decodeAll(split.fragment())); } return builder.create(); } private  Urls(); @Nonnull static URI createURI(@Nonnull String fullUrl); @Nonnull static String escape(@Nonnull String url); static UrlBuilder http(String host); static UrlBuilder https(String host); @Nonnull static Url parse(String url);  }