开发者

How to add custom filters in JBoss Seam

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.


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);
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜