I have overridden the RequestCycle.onRuntimeException method:

@Override
public RequestCycle newRequestCycle(final Request request, final Response
response) {
    return new WebRequestCycle(this, (WebRequest) request, (WebResponse)
response) {

        @Override
        public Page onRuntimeException(Page page, RuntimeException e) {
            Throwable t = e.getCause();
            while(t != null) {
                if(t instanceof PageExpiredException) {
                    return super.onRuntimeException(page, new
PageExpiredException("test"));
                }

                t = t.getCause();
            }
            return super.onRuntimeException(page, e);
        }
    };
}

He comes in the if(t instanceof PageExpiredException)..., but in the
AbstractRequestCycleProcessor.respond(RuntimeException e, RequestCycle
requestCycle) method he doesn't do anything with the RuntimeException. So he
has still a WicketRuntimeException instead of the PageExpiredException.

Ann




igor.vaynberg wrote:
> 
> you can try unwrapping the exceptions in
> requestcycle.onruntimeexception and call super with the page exipred
> exception.
> 
> -igor
> 
> On Fri, Jul 10, 2009 at 3:00 AM, Ann Baert<[email protected]> wrote:
>> Hello,
>>
>> How can I throw a PageExpiredException in the constructor of my WebPage?
>> Because the exception is wrapped by Wicket with WicketRuntimeException it
>> goes to the InternalErrorPage.
>>
>> Thanks,
>> Ann
>> **** DISCLAIMER ****
>>  http://www.tvh.be/newen/pages/emaildisclaimer.html 
>> http://www.tvh.be/newen/pages/emaildisclaimer.html  
>>
>> "This message is delivered to all addressees subject to the conditions
>> set forth in the attached disclaimer, which is an integral part of this
>> message."
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-throw-new-PageExpiredException--tp24424791p24457324.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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

Reply via email to