Setting HTTP Caching Headers - Expires
The Expires header specifies when content will expire,
or how long content is “fresh.” After this time, the portal server
will always check back with the remote server to see if the content
has changed.
Most web servers allow setting an absolute time to expire,
a time based on the last time that the client saw the object (last
access time), or a time based on the last time the document changed
on your server (last modification time).
In JSP, setting caching
to forever using the Expires header is as simple as using the code
that follows:
<%
response.setDateHeader("Expires",Long.MAX_VALUE);
%>
Note: Never use Expires = 0 to prevent
caching. The Expires header is sent by the remote server and passed
through to the browser by the Portal Server. Unless the time on all
three machines is synchronized, an Expires=0 header can
mistakenly return cached content. To solve this problem, set the Expires
header to a fixed date that is definitely in the past.