什么时候会进行 SpringMVC重定向保存参数(FlashMap)?

SpringMVC重定向保存参数(FlashMap):
两种情况会保存参数:
    1. 当前视图为RedirectView,也即是说当前请求为重定向请求。
        org.springframework.web.servlet.view.RedirectView#renderMergedOutputModel!RequestContextUtils.saveOutputFlashMap(targetUrl, request, response);
        
    2. 当前处理方法HandlerMethod,其执行后的返回值为HttpEntity扩展类(HttpEntity.class.isAssignableFrom(returnType.getParameterType()) && !RequestEntity.class.isAssignableFrom(returnType.getParameterType()))。
        org.springframework.web.servlet.mvc.method.annotation.HttpEntityMethodProcessor#saveFlashAttributes!RequestContextUtils.saveOutputFlashMap(location, req, res);
    
内部跟踪以上两个方法,最终会调用org.springframework.web.servlet.support.SessionFlashMapManager#updateFlashMaps方法,以便于将FlashMap保存。

posted @ 2019-11-21 11:52  GordonDicaprio  阅读(402)  评论(0编辑  收藏  举报