使用 JBoss Seam (EJB3+JSF) 审核日志

发布于 2024-07-16 10:23:09 字数 346 浏览 5 评论 0原文

我需要为用 JBoss Seam 编写的 Web 应用程序实现审核日志。 EntityListener 似乎是不错的候选者,但我不知道如何将 EntityListener 连接到应用程序会话上下文以将登录的使用主体包含在审核记录中。

我想知道是否有一种方法可以实现这种“连接”,或者是否有一种更舒适/优雅/有效的方法来实现此编程环境的审核日志。

提前致谢。

拉法。

编辑:
非常感谢达摩的解答! 我尝试注入我的身份组件,但没有成功。 但是,建议的对 Component.getInstance() 的调用确实在 EntityListener 中提供了对用户身份的所需引用。

I would need to implement an audit log for a web application written with JBoss Seam. EntityListeners seem like good candidates, but I don't know how to connect the EntityListeners to the application session context to include the logged in used principal in the audit record.

I wonder if there is a way to do this "connection", or if there is a more confortable/elegant/effective way to implement an audit log for this programming environment.

Thanks in advance.

Rafa.

Edit:
Many thanks to Damo for his answer! I tried the injection of my identity component, but it did not work. However, the suggested call to Component.getInstance() did provide the desired reference to the user's identity in the EntityListener.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

北方的巷 2024-07-23 10:23:09

您是否尝试过将应用程序/会话范围的 Bean 注入到 EntityListener 中? 或者如果注入不可用,则使用 Component.getInstance("myBean") 。

Have you tried injecting your Application/Session scoped Beans into the EntityListener? Or using Component.getInstance("myBean") if injection is unavailable.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文