/** * Gets the key in the map for the gadget URL. * * @param gadgetUrl * The gadget URL. * @return The key in the map for the gadget URL. */ private String getGadgetAdminDataKey(String gadgetUrl) { Set<String> gadgetUrls = this.gadgetAdminMap.keySet(); String normalizedGadgetUrl = createUrlWithPort(gadgetUrl); String key = null; for (String url : gadgetUrls) { String normalizedUrl = createUrlWithPort(url); if (normalizedUrl.endsWith(STAR) && normalizedGadgetUrl.startsWith(normalizedUrl.substring(0, normalizedUrl.length() - 1))) { if (key == null || (key != null && key.length() < normalizedUrl.length())) { key = url; } } else if (normalizedUrl.equals(normalizedGadgetUrl)) { key = url; break; } } return key; }