public static URI determineFinalEndpoint(URI endpoint,String bucket,ClientConfiguration clientConfig){
  try {
    StringBuilder conbinedEndpoint=new StringBuilder();
    conbinedEndpoint.append(String.format("%s://",endpoint.getScheme()));
    conbinedEndpoint.append(buildCanonicalHost(endpoint,bucket,clientConfig));
    conbinedEndpoint.append(endpoint.getPort() != -1 ? String.format(":%s",endpoint.getPort()) : "");
    conbinedEndpoint.append(endpoint.getPath());
    return new URI(conbinedEndpoint.toString());
  }
 catch (  URISyntaxException ex) {
    throw new IllegalArgumentException(ex.getMessage(),ex);
  }
}

public static URI determineFinalEndpoint ( URI endpoint , String bucket , ClientConfiguration clientConfig ) { try { StringBuilder conbinedEndpoint = new StringBuilder ( ) ; conbinedEndpoint . append ( String . format ( "%s://" , endpoint . getScheme ( ) ) ) ; conbinedEndpoint . append ( buildCanonicalHost ( endpoint , bucket , clientConfig ) ) ; conbinedEndpoint . append ( endpoint . getPort ( ) != - 1 ? String . format ( ":%s" , endpoint . getPort ( ) ) : "" ) ; conbinedEndpoint . append ( endpoint . getPath ( ) ) ; return new URI ( conbinedEndpoint . toString ( ) ) ; } catch ( URISyntaxException ex ) { throw new IllegalArgumentException ( ex . getMessage ( ) , ex ) ; } }
make a third - level domain by appending bucket name to front of original endpoint if no binding to cname , otherwise use original endpoint as second - level domain directly .
