UrlUtil { public static String rebaseUrl(String baseUrl, String relativeUrl) { StringBuilder url = new StringBuilder(StringUtils.removeEnd(baseUrl, "/")); if (StringUtils.isNotEmpty(relativeUrl)) { List<String> segments = new ArrayList<>(); segments.addAll(Arrays.asList(StringUtils.split(StringUtils.defaultString(relativeUrl), '/'))); for (String segment : segments) { url.append("/").append(segment); } if (StringUtils.endsWith(relativeUrl, "/")) { url.append("/"); } } else if (StringUtils.endsWith(baseUrl, "/")) { url.append("/"); } return url.toString(); }  static String rebaseUrl(String baseUrl, String relativeUrl);  }
@Test public void rebaseUrlTest() throws Exception { assertEquals("https: assertEquals("https: assertEquals("https: assertEquals("https: assertEquals("https: assertEquals("https: assertEquals("https: assertEquals("https: assertEquals("https: assertEquals("https: assertEquals("https: assertEquals("https: }