我正在Glide
用作客户端的图像加载器。我用java创建了我自己的服务器。
我的服务器代码:
File f = new File(imageLocation);
try{
bi = ImageIO.read(f);
}catch (Exception e){
f = new File(imageLocation);
bi = ImageIO.read(f);
}
respond = "HTTP/1.1 200 OK\r\n";
respond += "Date: " + LocalDateTime.now() + "\r\n";
respond += "Content-Type: image/png\r\n";
respond += "Content-Length: " + f.length() + "\r\n";
respond += "Connection: keep-alive\r\n";
respond += "\r\n";
output.write((respond).getBytes());
output.flush();
ImageIO.write(bi,"JPG",output);
output.flush();
我从浏览器进行了测试,它工作正常,但是当我Glide
从 android 调用使用时,没有显示图像