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 ; } }
Resolve a relative URL - THIS METHOD WILL NOT FAIL but will log a warning and return theEndpoint if the input is invalid .