wood burning stoves 2.0*
The moose likes Servlets and the fly likes Set Response Header on only Image Files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Set Response Header on only Image Files" Watch "Set Response Header on only Image Files" New topic
Author

Set Response Header on only Image Files

Mark Reyes
Ranch Hand

Joined: Jul 09, 2007
Posts: 426
I currently have a load time problem in my web application.

As I checked during friebug, my browser is not caching my images thus it request all images files everytime which slowsdown the application.
I looked up at the code and found below meta tag in all my JSP.


Any idea how can I make the browser cache only static files such as images/css/js? My app depends on AJAX to update the display so thats why I place the meta tags in most of my JSP.

Please help.


Sean Clark ---> I love this place!!!
Me ------> I definitely love this place!!!
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
Those headers are for the HTML page, not for embedded images etc. Make sure that those are served with appropriate cache headers; a tool like the Firefox plugin "LiveHTTPHeaders" can help you figure out what's going on in that regard. (Personally, I quite like HttpScoop for OS X.)
Mark Reyes
Ranch Hand

Joined: Jul 09, 2007
Posts: 426
Hi Lester,

Thanks for the reply. The problem that I am seeing is that the browser especially IE is not caching my images files/css/js files. Everytime it request for these files thereby slowing my apps. I am thinking of creating a filter for myself that will intercept all url, check for any images/css/js files then add the cache control response headers on *only* these files.

I actually still am studying if what I am thinking is possible but would like to hear your thoughts regarding these.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

Perhaps your browser settings are the issue?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Mark Reyes
Ranch Hand

Joined: Jul 09, 2007
Posts: 426
Perhaps your browser settings are the issue?


Hi Guru..

I actually dont have an idea on these. I am using IE6 as my test browser since these is what encounters most of the lagging. Can you explain alittle bit about this setting? Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Set Response Header on only Image Files
 
Similar Threads
jsp not reflecting changes
invalidate session object in struts2
Question on NOT Cache....
no cache for images
Jasper Report in Struts JSP