【问题标题】:Websphere exception handlingWebsphere 异常处理
【发布时间】:2010-04-06 00:27:03
【问题描述】:

从安全的角度来看,使用 Websphere 处理应用程序错误的最佳解决方案是什么?

我一直在考虑创建一个每次生成应用程序错误时调用的类,记录错误并向用户显示一般错误消息。

在 PHP 中,这可以使用 set_exception_handler() 函数来实现。是否有类似的 websphere 可以在 web.xml 中配置?

我在网上找到了这样的代码:

<error-page>
  <error-code>500</error-code>
  <location>/servlet/ExceptionHandlerServlet</location>
</error-page>

但这仅适用于“500”HTTP 错误代码。我真的想要一些通用的东西来捕捉一切。类似于实现某个接口的类,该接口可以访问有关错误的所有信息。

感谢您的宝贵时间。

【问题讨论】:

    标签: security jsp error-handling websphere web.xml


    【解决方案1】:

    这在 web.xml 中也可用:

     <error-page>
       <exception-type>UnhandledException</exception-type>
       <location>UnhandledException.jsp</location>
     </error-page>
    

    在其他地方,这用于this WebSphere example。 JEE5 教程也可能有助于设置它,尤其是关于 mapping servlet exceptions 和 creating JSP error pages 的部分。

    基本上,您的所有异常都应该包含在 ServletExceptions 中,并且您映射到的 JSP 应该在页面的最顶部设置 &lt;%@ page isErrorPage="true" %&gt;。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-15
      • 1970-01-01
      相关资源
      最近更新 更多