protected String resolveURL(ApiWrapper wrapper, String url) throws IOException { String result = ""; HttpResponse reso = wrapper.head(Request.to(Endpoints.RESOLVE).with("url", url)); if (reso.getStatusLine().getStatusCode() != HttpStatus.SC_MOVED_TEMPORARILY) throw new CloudAPI.ResolverException("Invalid status code", reso); // Header location = reso.getFirstHeader("Location"); if (!reso.containsHeader("Location")) throw new CloudAPI.ResolverException("No location header", reso); result = reso.getFirstHeader("Location").getValue(); return result; }