毕加索网址不加载

时间:2014-06-01 11:58:25

标签: android picasso

我有一个动态网址,可以为用户显示头像。

http://www.dapptapp.com/contents/avatar/200/200/27.png

图像确实在浏览器中显示,但毕加索没有显示任何图像。

使用当前代码:

 getPicasso().load("http://www.dapptapp.com/contents/avatar/200/200/27.png").into(civAvatar);

是否与图像的标题有关。我似乎无法查明错误。如果我使用网络上的任何其他常规图像都没有问题。

邮递员对网址的回复:

Connection →Keep-Alive
Content-Encoding →
Content-Encoding
The type of encoding used on the data.

gzip
Content-Length →36908
Content-Type →image/png
Date →Tue, 03 Jun 2014 14:44:22 GMT
Keep-Alive →timeout=1, max=100
Server →Apache
Vary →Accept-Encoding,User-Agent

1 个答案:

答案 0 :(得分:1)

我也遇到了这个问题。

如果没有提供ok-http lib,Picasso使用UrlConnectionDownloader加载url。

似乎有时它使用param boolean localCacheOnly = true加载url,并且标头设置为HttpUrlConnection。

connection.setUseCaches(true)
connection.setRequestProperty("Cache-Control", "only-if-cached,max-age=" + Integer.MAX_VALUE);

然后返回此标题:

X-Android-Response-Source CACHE 504

由毕加索分叉修正并评论这些线条。我认为可能有更好的解决方案。