Hello.

I am facing the following problem when migrating from Wicket 1.4.16 to
1.5 RC3. First, I'll explain what I want to accomplish, how I do that
in 1.4.16 and the result obtained. Next, I'll explain how I try to do
the same wich 1.5 RC3, and which are the results I get.

1.- I want all of the pages in my web application to avoid caching, so
they are loaded every time I use the back or reload buttons in the web
application. To accomplish this, I use the following code in my
BasePage class:
        @Override
        protected void configureResponse() {
                super.configureResponse();
                WebResponse response = getWebRequestCycle().getWebResponse();
                response.setHeader("Cache-Control",
                                "no-cache, max-age=0,must-revalidate, 
no-store");
        }
By doing this, every time I reload a page from a browser, and every
time I use the back button on the browser, the page is fully reloaded:
it's constructor in the Java class is called, and every item in the
page is reloaded.

2.- To accomplish the same thing in Wicket 1.5, I use following code
in my BasePage class:
        @Override
        protected void configureResponse() {
                super.configureResponse();
                WebResponse response = (WebResponse) 
getRequestCycle().getResponse();
                response.setHeader("Cache-Control",
                                "no-cache, max-age=0,must-revalidate, 
no-store");
        }
The problem is that when I hit the back button or the reload button in
the browser, the constructor of the page is not called, and so the
page is not fully reloaded. If the back button is used, the
applications throws  "java.lang.ClassCastException:
javax.swing.tree.DefaultMutableTreeNode cannot be cast to
java.lang.String".I think this is motivated because the tree is
created via Ajax, and since the constructor of the page is not called,
it is not initialized when hitting the back button and tries to create
the tree using a null model.

May the root problem has something to do with the "must-revalidate"
option? In the caching tutorial of wicket 1.5 it explicitly says
"We are not sending Cache-Control: must-revalidate anymore since it
implies the resource can theoretically be cached when in fact it must
not."
If this is the problem, is there some workaround to obtain the same
result as with the "must-revalidate" option?


Any advice or hint will be appreciated, and thank you very much for
your attention.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to