Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Set Response Header on only Image Files

 
Mark Reyes
Ranch Hand
Posts: 426
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 426
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64824
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps your browser settings are the issue?
 
Mark Reyes
Ranch Hand
Posts: 426
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic