CacheIdUtil { public static String createCacheId(String baseUrl, String file, String contextRoot) { if(!baseUrl.endsWith("/") && !file.startsWith("/")) { baseUrl += "/"; } URL url = null; try { url = new URL(new URL(baseUrl), file); if(file.startsWith("http") && contextRoot.startsWith("http")) { URL contextUrl = new URL(contextRoot); contextRoot = contextUrl.getProtocol() + ": } } catch (MalformedURLException e) { _log.error("URL: " + baseUrl + file + " is malformed.", e); } return contextRoot + url.getPath(); }  static String createCacheId(String baseUrl, String file, String contextRoot);  }
@Test public void testCreateCacheIdAbsoluteURL() { String cacheId = CacheIdUtil.createCacheId("http: "http: "http: assertEquals("http: }
@Test public void testCreateCacheIdAbsoluteURLWithPort() { String cacheId = CacheIdUtil.createCacheId("http: "http: "http: assertEquals("http: }