> + .build( > + new CacheLoader<URI, URI>() { > + public URI load(URI baseEndpointUri) { > + URI versionEndpointUri = null; > + try { > + HttpRequest negotiationRequest = HttpRequest.builder() > + .method("GET").endpoint(baseEndpointUri) > + .addHeader(VERSION_NEGOTIATION_HEADER, > "true").build(); > + InputStream response = > client.invoke(negotiationRequest).getPayload().openStream(); > + VersionsJsonResponse versions = > json.fromJson(Strings2.toStringAndClose(response), > VersionsJsonResponse.class); > + for( VersionsJsonResponse.Version version : > versions.versions ) { > + if(apiVersion.equals(version.id)) { > + String newURIString = version.links.get(0).href; > + if(newURIString.startsWith("http:") && > baseEndpointUri.toString().startsWith("https:")) > + newURIString = "https" + > newURIString.substring(4); > + versionEndpointUri = new URI(newURIString);
Can we use [Uris](https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/http/Uris.java), for this, rather than doing string manipulation directly? --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-openstack/pull/82/files#r10724016