簡體   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