security - Websphere 异常处理

标签 security jsp error-handling websphere web.xml

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

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

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

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

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

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

谢谢你的时间。

最佳答案

这在 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 应该有 <%@ page isErrorPage="true" %>设置在页面的最顶部。

关于security - Websphere 异常处理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2581942/

相关文章:

php - 评估 php shell hack

windows - 那么,Windows Atom 表的用途是什么?

java - jqGrid : show/hide columns while Updating and Inserting data

swift - 当抛出一个可选的-nil错误时,如何获得默认的错误字符串?

c# - MessageBox展开按钮以获取进一步的错误描述

powershell - FTP上传文件时出错

php - 黑客可以对网站执行什么操作以及如何保护我的网站免受这些攻击?

wcf - 从 http 到 Https 服务调用

java - Get-Set Java 中图像的数据类型应该是什么

jsp - 在使用 tomcat 7 的 jspc 预编译 jsp 期间未评估 el