@Test public void resolvesRelativeUrls() { assertEquals("http: assertEquals("http: assertEquals("http: assertEquals("https: assertEquals("http: assertEquals("https: assertEquals("https: assertEquals("https: assertEquals("https: assertEquals("https: assertEquals("", resolve("wrong", "also wrong")); assertEquals("ftp: assertEquals("ftp: assertEquals("ftp: }
public static URL resolve(URL base, String relUrl) throws MalformedURLException { if (relUrl.startsWith("?")) relUrl = base.getPath() + relUrl; if (relUrl.indexOf('.') == 0 && base.getFile().indexOf('/') != 0) { base = new URL(base.getProtocol(), base.getHost(), base.getPort(), "/" + base.getFile()); } return new URL(base, relUrl); }
StringUtil { public static URL resolve(URL base, String relUrl) throws MalformedURLException { if (relUrl.startsWith("?")) relUrl = base.getPath() + relUrl; if (relUrl.indexOf('.') == 0 && base.getFile().indexOf('/') != 0) { base = new URL(base.getProtocol(), base.getHost(), base.getPort(), "/" + base.getFile()); } return new URL(base, relUrl); } }
StringUtil { public static URL resolve(URL base, String relUrl) throws MalformedURLException { if (relUrl.startsWith("?")) relUrl = base.getPath() + relUrl; if (relUrl.indexOf('.') == 0 && base.getFile().indexOf('/') != 0) { base = new URL(base.getProtocol(), base.getHost(), base.getPort(), "/" + base.getFile()); } return new URL(base, relUrl); }  }
StringUtil { public static URL resolve(URL base, String relUrl) throws MalformedURLException { if (relUrl.startsWith("?")) relUrl = base.getPath() + relUrl; if (relUrl.indexOf('.') == 0 && base.getFile().indexOf('/') != 0) { base = new URL(base.getProtocol(), base.getHost(), base.getPort(), "/" + base.getFile()); } return new URL(base, relUrl); }  static String join(Collection strings, String sep); static String join(Iterator strings, String sep); static String padding(int width); static boolean isBlank(String string); static boolean isNumeric(String string); static boolean isWhitespace(int c); static boolean isActuallyWhitespace(int c); static String normaliseWhitespace(String string); static void appendNormalisedWhitespace(StringBuilder accum, String string, boolean stripLeading); static boolean in(String needle, String... haystack); static boolean inSorted(String needle, String[] haystack); static URL resolve(URL base, String relUrl); static String resolve(final String baseUrl, final String relUrl); static StringBuilder stringBuilder(); }
StringUtil { public static URL resolve(URL base, String relUrl) throws MalformedURLException { if (relUrl.startsWith("?")) relUrl = base.getPath() + relUrl; if (relUrl.indexOf('.') == 0 && base.getFile().indexOf('/') != 0) { base = new URL(base.getProtocol(), base.getHost(), base.getPort(), "/" + base.getFile()); } return new URL(base, relUrl); }  static String join(Collection strings, String sep); static String join(Iterator strings, String sep); static String padding(int width); static boolean isBlank(String string); static boolean isNumeric(String string); static boolean isWhitespace(int c); static boolean isActuallyWhitespace(int c); static String normaliseWhitespace(String string); static void appendNormalisedWhitespace(StringBuilder accum, String string, boolean stripLeading); static boolean in(String needle, String... haystack); static boolean inSorted(String needle, String[] haystack); static URL resolve(URL base, String relUrl); static String resolve(final String baseUrl, final String relUrl); static StringBuilder stringBuilder();  }