/** * Resolve a relative URL - THIS METHOD WILL NOT FAIL but will log a warning and return theEndpoint if the input is invalid. */ public static String constructAbsoluteUrl(String theBase, String theEndpoint) { if (theEndpoint == null) { return null; } if (isAbsolute(theEndpoint)) { return theEndpoint; } if (theBase == null) { return theEndpoint; } try { return new URL(new URL(theBase), theEndpoint).toString(); } catch (MalformedURLException e) { ourLog.warn("Failed to resolve relative URL[" + theEndpoint + "] against absolute base[" + theBase + "]", e); return theEndpoint; } }
/** * Returns <code>true</code> if this ID contains an absolute URL (in other words, a URL starting with "http://" or "https://" */ @Override public boolean isAbsolute() { if (StringUtils.isBlank(getValue())) { return false; } return UrlUtil.isAbsolute(getValue()); }
/** * Resolve a relative URL - THIS METHOD WILL NOT FAIL but will log a warning and return theEndpoint if the input is invalid. */ public static String constructAbsoluteUrl(String theBase, String theEndpoint) { if (theEndpoint == null) { return null; } if (isAbsolute(theEndpoint)) { return theEndpoint; } if (theBase == null) { return theEndpoint; } try { return new URL(new URL(theBase), theEndpoint).toString(); } catch (MalformedURLException e) { ourLog.warn("Failed to resolve relative URL[" + theEndpoint + "] against absolute base[" + theBase + "]", e); return theEndpoint; } }
/** * Returns <code>true</code> if this ID contains an absolute URL (in other words, a URL starting with "http://" or "https://" */ @Override public boolean isAbsolute() { if (StringUtils.isBlank(getValue())) { return false; } return UrlUtil.isAbsolute(getValue()); }