I\'m serving up images from my servlet. The response content type is image/jpeg. I find that images requested from my servlet are not cached. How do I get them to be cached
For example, if you want to cache them for 1 month:
Calendar inOneMonth = Calendar.getInstance();
inOneMonth.add(Calendar.MONTH, 1);
response.setDateHeader("Expires", inOneMonth.getTimeInMillis());
(this is in a Filter that handles the *.jpg pattern, for example)
But images should be cached by default - check your filters and configurations to see if something isn't setting the cache parameters incorrectly.