This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Servlets and the fly likes Problem: Server serves old version of image. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "Problem: Server serves old version of image." Watch "Problem: Server serves old version of image." New topic
Author

Problem: Server serves old version of image.

Girish Gopal
Greenhorn

Joined: Nov 13, 2008
Posts: 10
I run my web application in tomcat.I have some image files which gets changed frequently.But these changes doesn't get reflected in the jsp's where I show it.

I dont't think its the problem of browser is caching the image file because I have tried clearing the browser,and even tried from a browser of different system.

I also tried to attach a timestamp with the image file so that the cached version is ignored but it was of no avail.


But the changes get refreshed if I restart the server. So I believe something has to be done at the server end.

Any help on it would be appreciated ?

Thanks
Girish
Arun Christopher
Greenhorn

Joined: Nov 18, 2008
Posts: 19
Dear Girish,
Put that img tag inside a div and better try reloading the div with ajax calls at regular intevals so that the image gets changed at regular intervals.

-Arun Christopher
Girish Gopal
Greenhorn

Joined: Nov 13, 2008
Posts: 10
Dear Arun,

I think U have got me wrong. Its not the problem of refreshing the content in the browser automatically.But the problem is the image doesn't change to new one on doing a manual refresh.

It's not loading the changed image even if I try to access it with a new http request through browser .And Ajax xmlhttprequest's does'nt do anything different ,it request for the resource.

Thanks
Girish
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Problem: Server serves old version of image.
 
It's not a secret anymore!