import org.apache.wicket.protocol.http.WebResponse;
/**
- * Behavior to disable browser caching.
+ * <p>
+ * Behavior to disable browser caching. This also means that the page
+ * automatically expires the first time after it is rendered.
+ * </p>
+ *
+ * <p>
+ * Important: To make sure that form data cannot be submitted twice for
+ * the same data using the back button, it is still necessary to explicitly call
+ * <code>getPage().getPageMap().remove(getPage());</code>
+ * in the <code>onSubmit</code> callback of the form.
+ * </p>
*
* @author Erik Brakkee
*
*/
-public class DisableCachingBehavior extends AbstractPageBehavior {
+public class DisableCachingBehavior extends ExpirePageImmediatelyBehavior {
@Override
public void setHeaders(WebPage aPage, WebResponse aResponse) {
+ System.out.println("Disabling caching for " + aPage.getClass().getName());
aResponse.setHeader("Pragma", "no-cache");
aResponse.setHeader("Cache-Control",
"no-cache, max-age=0, must-revalidate, no-store");