Reputation: 8724
I am trying to cache images on my jsp page.
I know that I can cache everything like this:
httpResponse.setDateHeader("Expires", System.currentTimeMillis() + 604800000L);
But I need to set expiration cache only for images. How can I do that? What is the easiest way?
Thanks
Upvotes: 0
Views: 496
Reputation: 1504
Create a servlet filter
which will listen for URLs that end in *.jpg, *.gif, *.png etc. and add the expires header in the response.
Upvotes: 2