sn0ep
sn0ep

Reputation: 3943

Picasso url does not load

I have a dynamic url to show avatars for users.

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

the image does show in the browser but picasso does not show any image.

the current code is used:

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

is it something that has to do with the headers of the image or something. I can't seem to pinpoint the error. If I use any other regular image from the web there is no problem.

Postman response on the URL:

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

Upvotes: 0

Views: 3429

Answers (1)

javamonk
javamonk

Reputation: 180

I was run into this problem too.

If ok-http lib not provided, Picasso using UrlConnectionDownloader to load url.

Seems that some times it load url with param boolean localCacheOnly=true, and a header is setting to HttpUrlConnection.

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

Then it returns this header:

X-Android-Response-Source CACHE 504

Fixed by fork Picasso and comment these lines. I thinks there may be better solutions.

Upvotes: 1

Related Questions