I have the following code in my project (JSF1.2, RF 3.3.3 SR1, GF 3.0.1)
// Following code in PhaseListener
@Override
public void beforePhase(PhaseEvent event) {
if (event.getPhaseId() == PhaseId.RENDER_RESPONSE) {
HttpServletResponse res = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();
res.addHeader("pragma", "no-cache, no-store, must-revalidate, max-age=0, s-max-age=0, proxy-revalidate");
res.addDateHeader("Expires", 0);
res.addHeader("cache-control", "no-cache, no-store, must-revalidate, max-age=0, s-max-age=0, proxy-revalidate");
}
}
I tested the above code in IE, FF, Safari and it worked fine.
After upgrading the above project to JSF 2.0 (JSF2.0, RF 4.0.0 Final, GF 3.0.1), the above code is not clearing the cache. I tried to replace addHeader with setHeader with no luck.
Also, I tried to implement the above code in a Filter as mentioned here, but it didn't help.
Thanks in advance,
Praneeth