yup!  works great

actually I had to use e.getCause() instanceof...

thanks (as usual) for the excellent help!

ryan


On Jun 23, 2009, at 11:19 PM, Igor Vaynberg wrote:

have you tried

class myrequestcycle extends webrequestcycle {
 onruntimeexception(e) {
    if (e instanceof pageexpiredexeption) {
         if (getrequst().isajax()) {
                 // this is an ajax request that caused pep exception
                 throw new abortwithhttpstatusexception(400);
           }}}}

-igor

On Tue, Jun 23, 2009 at 6:13 PM, Ryan McKinley<ryan...@gmail.com> wrote:
Is there anyway for an ajax call to catch the PageExpiredException?

I am using the jquery history plugin to load pages in wicket
(http://www.mikage.to/jquery/jquery_history.html) -- this lets me do
ajax updates with bookmarkable urls.  The one issue I am having is
that if the session has expired it gives a big error when I could
easily recover by simply refreshing the whole page.

I figured the failure callback on wicketAjaxGet would let me do this.
I have tried:

function pageload(hash) {
var cburl = "../?wicket:interface=:0::IActivePageBehaviorListener: 1:1&wicket:ignoreIfNotActive=true"
+ "&hash="+hash;
 wicketAjaxGet( cburl, function(){}, function(){
   // on failure... reload the whole page...
   alert( "Dooh " + document.location  );
   window.location.reload();
 } );
}

This works fine if the server is turned off, but for the
PageExpiredException - it redirects to:
http://localhost:8080/?wicket:bookmarkablePage=:org.apache.wicket.markup.html.pages.InternalErrorPage

anyway to avoid that?

Perhaps override WebApplication:
protected Page onDeploymentRuntimeException(Page cause, RuntimeException ex) {
    // ????
 }

but not sure what is the wicket way...

thanks for any pointers!

ryan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to