question: protected String computeFullUrl ( URL baseUrl , String link ) { if ( link == null || link . length ( ) == 0 ) { return null ; } if ( ! link . startsWith ( "http" ) ) { if ( link . startsWith ( "/" ) ) { link = baseUrl . getProtocol ( ) + "://" + baseUrl . getAuthority ( ) + link ; } else { if ( link . contains ( ":" ) ) { return null ; } String path = baseUrl . getPath ( ) ; if ( ! path . endsWith ( "/" ) ) { int sep = path . lastIndexOf ( "/" ) ; String file = path . substring ( sep + 1 ) ; if ( file . contains ( "." ) || file . contains ( "?" ) ) path = path . substring ( 0 , sep ) ; } link = baseUrl . getProtocol ( ) + "://" + baseUrl . getAuthority ( ) + path + "/" + link ; } } link = normalizeUrlEnding ( link ) ; String l = link . toLowerCase ( Locale . ROOT ) ; if ( l . endsWith ( ".jpg" ) || l . endsWith ( ".jpeg" ) || l . endsWith ( ".png" ) || l . endsWith ( ".gif" ) ) { return null ; } return link ; }
target:  Computes the full URL based on a base url and a possibly relative link found in the href param of an HTML anchor.