gpt4 book ai didi

java - 如何在 Wicket 的 InternalErrorPage 中显示堆栈跟踪

转载 作者:搜寻专家 更新时间:2023-11-01 02:52:50 25 4
gpt4 key购买 nike

我有一个自定义的 InternalErrorPage,我将其放入 ApplicationSettings 中,如下所示:

getApplicationSettings().setInternalErrorPage(InternalErrorPage.class);
getExceptionSettings().setUnexpectedExceptionDisplay(
IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE);
getRequestCycleSettings().setUnexpectedExceptionDisplay(
IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE);

我想在此页面上显示堆栈跟踪(当然,如果我处于开发模式)。我该怎么做?

最佳答案

在 Wicket 1.4 中你可以使用

getRequestCycle().onRuntimeException(new MyErrorPage(), theException);

看看Wicket wikithe mailing list以获得进一步的解释。

在 Wicket 1.5 中,onRuntimeException 是 removed .相反,你可以

"add your own org.apache.wicket.request.cycle.IRequestCycleListener (AbstractRequestCycleListener) with org.apache.wicket.Application.getRequestCycleListeners().add() and implement its #onException(RequestCycle, Exception)" (quoted from here)

关于java - 如何在 Wicket 的 InternalErrorPage 中显示堆栈跟踪,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7934912/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com