I use these code in order to avoid web page cache, in browser and in wicket 
application;
also I want to avoid disk caching and serialization

I'm using Wicket6


¿ Do you see this code correct ? ¿ Is there any easier way to accomplish this ?

/**
 * App
 */
public class MyApplication extends WebApplication {
    @Override
    public void init() {
        super.init();
        setPageManagerProvider(new MyPageManagerProvider(this));
    }

    /**
     * shall not save
     */
    private class MyPageManagerProvider extends DefaultPageManagerProvider {

        private MyPageManagerProvider(Application application) {
            super(application);
        }


        @Override
        protected IDataStore newDataStore() {
            // guardamos tod o en memoria
            return new HttpSessionDataStore(new DefaultPageManagerContext(), 
new PageNumberEvictionStrategy(0));
        }

    }

}


/******************************************************************************************/

/**
 * Web Page
 */
public class MyPage extends WebPage {

    @Override
    protected void setHeaders(WebResponse response) {
        super.setHeaders(response);
        response.setHeader("X-Frame-Options","deny"); // Avoid  IFRFAMES
        response.setHeader("Cache-Control", 
"no-cache,no-store,private,must-revalidate,max-stale=0,post-check=0,pre-check=0");
        response.setHeader("Expires","0");
        response.setHeader("Pragma", "no-cache");
        response.disableCaching();
    }

}




    > > > Oscar Besga Arcauz  < < < 
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to