Archive for the ‘Application Server’ Category

Java: Servlet Set Expires Header with Cache Control

Saturday, March 28th, 2009

When setting the expires date in Servlet, better to set the cache-control as well.

final int CACHE_DURATION_IN_SECOND = 60 * 60 * 24 * 2; // 2 days
final long   CACHE_DURATION_IN_MS = CACHE_DURATION_IN_SECOND  * 1000;
long now = System.currentTimeMillis();
//res being the HttpServletResponse of the request
res.addHeader("Cache-Control", "max-age=" + CACHE_DURATION_IN_SECOND);
res.addHeader("Cache-Control", "must-revalidate");//optional
res.setDateHeader("Last-Modified", now);
res.setDateHeader("Expires", now + CACHE_DURATION_IN_MS);

For no cache

res.setHeader("Pragma", "No-cache");
res.setHeader("Cache-Control", "no-cache,no-store,max-age=0");
res.setDateHeader("Expires", 1);

IBM: WebSphere Portal Express

Wednesday, October 29th, 2008

Make sure that you are logged into logged into your machine’s local admin account before installing. If you don’t - whether or not the account is an admin it will fail to install properly.

PS - It takes about 2:30 to install it completely.