A quote from Wicket in Action:
=============
The three custom error pages can be set in the init method of your Application using the application settings. Here’s an example:

@Override
protected void init() {
IApplicationSettings settings = getApplicationSettings();
settings.setAccessDeniedPage(CheesrAccessDeniedPage.class);
settings.setPageExpiredErrorPage(CheesrPageExpiredErrorPage.class);
settings.setInternalErrorPage(CheesrInternalErrorPage.class);
}
=============
Doesn't this accomplish what you want?

Regards,
Linda

Ann Baert wrote:
That's not how I want it.
I have a custom PageExpiredErrorPage (and AccessDenied...), so he has to
take those automaticly.
getApplicationSettings().setPageExpiredErrorPage(CustomPageExpiredErrorPage.class);
With your solution I have to repeat them everywhere, like I do now with
setResponsePage().



Serkan Camurcuoglu-3 wrote:
If all you want is to display a page expired page, maybe you could just
use

throw new RestartResponseException(PageExpiredErrorPage.class);

in your page constructor.



Ann Baert wrote:
Can anyone help me with this problem please?
Thanks in advance, Ann.



Ann Baert wrote:
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]



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




------------------------------------------------------------------------


No virus found in this incoming message.
Checked by AVG - www.avg.com Version: 8.5.375 / Virus Database: 270.13.16/2240 - Release Date: 07/15/09 17:58:00



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

Reply via email to