public static URI replaceHost ( final URI uri , final String newHost , final boolean strict ) throws URISyntaxException { final URI hostUri = newUri ( newHost , strict ) ; return newUri ( uri . toString ( ) . replaceFirst ( Pattern . quote ( uri . getHost ( ) ) , Matcher . quoteReplacement ( hostUri . getHost ( ) ) ) , strict ) ; }
Returns a new URI with the host portion replaced by the new host portion