如何在JBoss Seam中添加自定义过滤器 [英] How to add custom filters in JBoss Seam

查看:103
本文介绍了如何在JBoss Seam中添加自定义过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是JBoss Seam的新手.我在处理一个小项目时遇到了问题.该项目存在一些错误,但不幸的是,我无法找出错误的确切原因.我得到了javax.servlet.ServletException.请有人告诉我如何添加自定义过滤器,以便我能够正确地捕获错误.

I am new to JBoss Seam. I have been having issues with a small project am working on. The project has some errors and unfortunately for me I cannot find out the exact cause of the errors. I get a javax.servlet.ServletException. Please could someone tell me how to add custom filters so that I would be able to trap errors properly.

推荐答案

如果要trap Seam中发生的所有同步异常,请扩展Seam中的Exceptions类.

If you want to trap all synchronous exceptions happening in Seam, you extend the Exceptions class in Seam.

@Name("org.jboss.seam.exception.exceptions")
@Scope(ScopeType.APPLICATION)
@Install(precedence = Install.APPLICATION)
@BypassInterceptors
@Transactional
public class ExceptionHandler extends Exceptions {

    private static final LogProvider log = Logging.getLogProvider(ExceptionHandler.class);

    public void handle(Exception ex) throws Exception {
         //Here you can do whatever you want with the exception
         log.error("Exception occurred : " + ex.getMessage());
         super.handle(ex);
    }

这篇关于如何在JBoss Seam中添加自定义过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆