code: public String getResourceUrl(String bucketName, String key) {
          try {
              return getUrl(bucketName, key).toString();
          } catch ( Exception e ) {
              return null;
          }
      }
docs: Returns the URL to the key in the bucket given, using the client's scheme
  and endpoint. Returns null if the given bucket and key cannot be
  converted to a URL.