How to add custom filters in JBoss Seam

…衆ロ難τιáo~ 提交于 2019-12-22 01:19:50

问题


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.


回答1:


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


来源:https://stackoverflow.com/questions/5424514/how-to-add-custom-filters-in-jboss-seam

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!