Which Wicket version?

Try out: new PageProvider(CustomErrorPage.class)

Regards
Sven

On 11/01/2013 08:42 PM, dgn wrote:
I have a page in which an entity's ID is passed as a parameter. During the
page construction a check is done on the backing database for the entity's
existence. If it doesn't exist a custom RepositoryProviderException is
thrown (which extends RuntimeException).

I have extended AbstractRequestCycleListener and added it to
RequestCycleListenerCollection in Application.init() In the onException()
method there is a check for the custom exception with a dispatch to a custom
error page, otherwise the standard error page:

public IRequestHandler onException(RequestCycle cycle, Exception e) {
        RepositoryProviderException rpe = Exceptions.findCause( e,
RepositoryProviderException.class );
        if (rpe != null) {
                return new RenderPageRequestHandler(new PageProvider(new
CustomErrorPage()));
        }
        return new RenderPageRequestHandler(new PageProvider(new ErrorPage()));
}

In testing when a RepositoryProviderException is thrown this method is
invoked multiple times. The first time creates the new CustomErrorPage
followed by two subsequent calls where the Exception parameter is always an
ExpiredPageException.

There is the following logging after the second two entries into this
method:
2013-11-01 15:26:50,008 WARN RequestCycleExtra:342 -
********************************
2013-11-01 15:26:50,009 WARN RequestCycleExtra:343 - Handling the following
exception
org.apache.wicket.protocol.http.PageExpiredException: Page with id '1' has
expired.
2013-11-01 15:26:50,009 WARN RequestCycleExtra:344 -
********************************
2013-11-01 15:26:50,018 WARN RequestCycleExtra:342 -
********************************
2013-11-01 15:26:50,018 WARN RequestCycleExtra:343 - Handling the following
exception
org.apache.wicket.protocol.http.PageExpiredException: Page with id '0' has
expired.
2013-11-01 15:26:50,018 WARN RequestCycleExtra:344 -
********************************

Why the extra calls and not the dispatch to CustomErrorPage, which is
stateless and isErrorPage() returns true; ???

Thanks in advance.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Cannot-get-to-desired-error-page-on-handling-RuntimeException-in-AbstractRequestCycleListener-onExce-tp4662078.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
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]

Reply via email to