我的图片有src blob:https/......。
像这样
为了下载图片,我测试了几种技术,但没有结果。
我试着像浏览器一样加载图片(http获取请求)。
public static void httpGetImage(String url, String path) {
//url ==> blob:https://www.colissimo.fr/5e50dd3d-5b7f-4861-b0ec-34e12f4f3af4
try {
HttpGet get = new HttpGet(url);
get.addHeader("content-type", "image/png");
try (CloseableHttpClient httpClient = HttpClients.createDefault();
CloseableHttpResponse response = httpClient.execute(get)) {
HttpEntity entity = response.getEntity();
if (entity != null) {
try (FileOutputStream outstream = new FileOutputStream(new File(path))) {
entity.writeTo(outstream);
}
}
httpClient.close();
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
我得到这个错误。
org.apache.http.client.ClientProtocolException: URI does not specify avalid host name:blob:https://www.colissimo.fr/5f67d9be-43bb-489d-8746-cf8fccf2cac9