繁体   English   中英

ControllerRunner的执行顺序

[英]ControllerRunner's Execution order

这是activeweb2.0源代码

protected void run(Route route) throws Exception {
    Configuration.injectFilters(); //no worries, will execute once, as filters have a life span of the app
    try {
        try { //nested try , a bit ugly, but we need to ensure filter.after() methods are executed.
            filterBefore(route);
            executeController(route);
        } finally {
            filterAfter(route);
        }
    }
    catch(ActionNotFoundException e){
        throw e;
    }
    catch (RuntimeException e) {
        RequestContext.setControllerResponse(null);//must blow away, as this response is not valid anymore.

        if (exceptionHandled(e, route)) {
            LOGGER.debug("A filter has called render(..) method, proceeding to render it...");
            renderResponse(route);//a filter has created an instance of a controller response, need to render it.
        }else{
            throw e;//if exception was not handled by filter, re-throw
        }
    }
}

如果executeController中发生DBException,将关闭数据库连接,然后将不执行rollbackTransaction,因此数据库中将出现一些错误结果

你是对的。 已报告此问题,并在以下位置解决此问题: https : //github.com/javalite/activeweb/issues/389

请升级到2.2版以获得正确的行为。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM