Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Filter/jpg client image refresh.

 
Miran Cvenkel
Ranch Hand
Posts: 202
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does nothing - as it should, image that is thumb does not get modified before served to client.
Hovewer, each time served, it reloads in browser, cache is ignored doh it is from same loc, same name, no changing link parameters.

How to prevent browser cache ignoratin ?

 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What headers are being sent in the response that contains the image?

Bill
 
Miran Cvenkel
Ranch Hand
Posts: 202
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It appears nothing is send by default.
Reading this: https://www.google.si/search?q=java+filter+cache&ie=utf-8&oe=utf-8&gws_rd=cr&ei=rSq7VoGPCOWB6ATA_7u4Dw# ....
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note that there are HTTP header fields that the browser interprets.

Some code somewhere has got to build the response containing headers, which, among other things tell the browser is image data and whether or not it can be cached. These headers will be followed by the binary jpg image data.

Bill

 
Miran Cvenkel
Ranch Hand
Posts: 202
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
according to this: http://www.onjava.com/pub/a/onjava/2004/03/03/filters.html



And appropriate filter code, like this



Img of firefox, where refresh/cache does not work, attached. Seems it receives max-age header, but that has no effect.
STASTUS: '200 OK' should be '304 Not modified'
Any idea on that ?
tmp.jpg
[Thumbnail for tmp.jpg]
 
Miran Cvenkel
Ranch Hand
Posts: 202
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Adding firefox screen shot: left image that gets cahed, right image that does not.
tmp1.jpg
[Thumbnail for tmp1.jpg]
 
Miran Cvenkel
Ranch Hand
Posts: 202
2
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Solution:

Code could be optimized, but it works. Just important things here.
If you write to client, Etag (UUID of image), you will get it back in form of request Header "If-None-Match"
Tested on FireFox.

 
J. Kevin Robbins
Bartender
Pie
Posts: 1801
28
Chrome Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Miran Cvenkel wrote:Solution:

Code could be optimized, but it works. Just important things here.
If you write to client, Etag (UUID of image), you will get it back in form of request Header "If-None-Match"

Very interesting fix. I have never used that header. I'm giving you a cow for coming back with the solution. It's bound to help someone else in the future.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic