/** * Returns a builder for the URL that would be retrieved by following {@code link} from this URL, * or null if the resulting URL is not well-formed. */ public @Nullable Builder newBuilder(String link) { try { return new Builder().parse(this, link); } catch (IllegalArgumentException ignored) { return null; } }
/** * Returns a new {@code HttpUrl} representing {@code url}. * * @throws IllegalArgumentException If {@code url} is not a well-formed HTTP or HTTPS URL. */ public static HttpUrl get(String url) { return new Builder().parse(null, url).build(); }
/** * Returns a builder for the URL that would be retrieved by following {@code link} from this URL, * or null if the resulting URL is not well-formed. */ public @Nullable Builder newBuilder(String link) { try { return new Builder().parse(this, link); } catch (IllegalArgumentException ignored) { return null; } }
/** * Returns a new {@code HttpUrl} representing {@code url} if it is a well-formed HTTP or HTTPS * URL, or throws an exception if it isn't. * * @throws MalformedURLException if there was a non-host related URL issue * @throws UnknownHostException if the host was invalid */ static HttpUrl getChecked(String url) throws MalformedURLException, UnknownHostException { Builder builder = new Builder(); Builder.ParseResult result = builder.parse(null, url); switch (result) { case SUCCESS: return builder.build(); case INVALID_HOST: throw new UnknownHostException("Invalid host: " + url); case UNSUPPORTED_SCHEME: case MISSING_SCHEME: case INVALID_PORT: default: throw new MalformedURLException("Invalid URL: " + result + " for " + url); } }
/** * Returns a new {@code HttpUrl} representing {@code url} if it is a well-formed HTTP or HTTPS * URL, or throws an exception if it isn't. * * @throws MalformedURLException if there was a non-host related URL issue * @throws UnknownHostException if the host was invalid */ static HttpUrl getChecked(String url) throws MalformedURLException, UnknownHostException { Builder builder = new Builder(); Builder.ParseResult result = builder.parse(null, url); switch (result) { case SUCCESS: return builder.build(); case INVALID_HOST: throw new UnknownHostException("Invalid host: " + url); case UNSUPPORTED_SCHEME: case MISSING_SCHEME: case INVALID_PORT: default: throw new MalformedURLException("Invalid URL: " + result + " for " + url); } }
/** * Returns a new {@code HttpUrl} representing {@code url} if it is a well-formed HTTP or HTTPS * URL, or throws an exception if it isn't. * * @throws MalformedURLException if there was a non-host related URL issue * @throws UnknownHostException if the host was invalid */ static HttpUrl getChecked(String url) throws MalformedURLException, UnknownHostException { Builder builder = new Builder(); Builder.ParseResult result = builder.parse(null, url); switch (result) { case SUCCESS: return builder.build(); case INVALID_HOST: throw new UnknownHostException("Invalid host: " + url); case UNSUPPORTED_SCHEME: case MISSING_SCHEME: case INVALID_PORT: default: throw new MalformedURLException("Invalid URL: " + result + " for " + url); } }
/** * Returns a new {@code HttpUrl} representing {@code url} if it is a well-formed HTTP or HTTPS * URL, or throws an exception if it isn't. * * @throws MalformedURLException if there was a non-host related URL issue * @throws UnknownHostException if the host was invalid */ static HttpUrl getChecked(String url) throws MalformedURLException, UnknownHostException { Builder builder = new Builder(); Builder.ParseResult result = builder.parse(null, url); switch (result) { case SUCCESS: return builder.build(); case INVALID_HOST: throw new UnknownHostException("Invalid host: " + url); case UNSUPPORTED_SCHEME: case MISSING_SCHEME: case INVALID_PORT: default: throw new MalformedURLException("Invalid URL: " + result + " for " + url); } }
/** * Returns a new {@code HttpUrl} representing {@code url} if it is a well-formed HTTP or HTTPS * URL, or null if it isn't. */ public static HttpUrl parse(String url) { Builder builder = new Builder(); Builder.ParseResult result = builder.parse(null, url); return result == Builder.ParseResult.SUCCESS ? builder.build() : null; }
/** * Returns a builder for the URL that would be retrieved by following {@code link} from this URL, * or null if the resulting URL is not well-formed. */ public Builder newBuilder(String link) { Builder builder = new Builder(); Builder.ParseResult result = builder.parse(this, link); return result == Builder.ParseResult.SUCCESS ? builder : null; }
/** * Returns a new {@code HttpUrl} representing {@code url}. * * @throws IllegalArgumentException If {@code url} is not a well-formed HTTP or HTTPS URL. */ public static HttpUrl get(String url) { return new Builder().parse(null, url).build(); }
/** * Returns a builder for the URL that would be retrieved by following {@code link} from this URL, * or null if the resulting URL is not well-formed. */ public @Nullable Builder newBuilder(String link) { Builder builder = new Builder(); Builder.ParseResult result = builder.parse(this, link); return result == Builder.ParseResult.SUCCESS ? builder : null; }
/** * Returns a builder for the URL that would be retrieved by following {@code link} from this URL, * or null if the resulting URL is not well-formed. */ public @Nullable Builder newBuilder(String link) { try { return new Builder().parse(this, link); } catch (IllegalArgumentException ignored) { return null; } }
/** * Returns a new {@code HttpUrl} representing {@code url} if it is a well-formed HTTP or HTTPS * URL, or null if it isn't. */ public static HttpUrl parse(String url) { Builder builder = new Builder(); Builder.ParseResult result = builder.parse(null, url); return result == Builder.ParseResult.SUCCESS ? builder.build() : null; }
/** Returns the URL that would be retrieved by following {@code link} from this URL. */ public HttpUrl resolve(String link) { Builder builder = new Builder(); Builder.ParseResult result = builder.parse(this, link); return result == Builder.ParseResult.SUCCESS ? builder.build() : null; }
/** Returns the URL that would be retrieved by following {@code link} from this URL. */ public HttpUrl resolve(String link) { Builder builder = new Builder(); Builder.ParseResult result = builder.parse(this, link); return result == Builder.ParseResult.SUCCESS ? builder.build() : null; }
/** * Returns a new {@code HttpUrl} representing {@code url} if it is a well-formed HTTP or HTTPS * URL, or null if it isn't. */ public static HttpUrl parse(String url) { Builder builder = new Builder(); Builder.ParseResult result = builder.parse(null, url); return result == Builder.ParseResult.SUCCESS ? builder.build() : null; }
/** * Returns a new {@code HttpUrl} representing {@code url} if it is a well-formed HTTP or HTTPS * URL, or null if it isn't. */ public static @Nullable HttpUrl parse(String url) { Builder builder = new Builder(); Builder.ParseResult result = builder.parse(null, url); return result == Builder.ParseResult.SUCCESS ? builder.build() : null; }
/** * Returns a new {@code HttpUrl} representing {@code url}. * * @throws IllegalArgumentException If {@code url} is not a well-formed HTTP or HTTPS URL. */ public static HttpUrl get(String url) { return new Builder().parse(null, url).build(); }