Example usage for org.springframework.web.method.annotation ModelFactory updateModel

List of usage examples for org.springframework.web.method.annotation ModelFactory updateModel

Introduction

In this page you can find the example usage for org.springframework.web.method.annotation ModelFactory updateModel.

Prototype

public void updateModel(NativeWebRequest request, ModelAndViewContainer container) throws Exception 

Source Link

Document

Promote model attributes listed as @SessionAttributes to the session.

Usage

From source file:co.paralleluniverse.springframework.web.servlet.mvc.method.annotation.FiberRequestMappingHandlerAdapter.java

private ModelAndView getModelAndView(ModelAndViewContainer mavContainer, ModelFactory modelFactory,
        NativeWebRequest webRequest) throws Exception {
    modelFactory.updateModel(webRequest, mavContainer);
    if (mavContainer.isRequestHandled()) {
        return null;
    }/*from   w  ww . j  a  va 2s  .  c om*/
    ModelMap model = mavContainer.getModel();
    ModelAndView mav = new ModelAndView(mavContainer.getViewName(), model);
    if (!mavContainer.isViewReference()) {
        mav.setView((View) mavContainer.getView());
    }
    if (model instanceof RedirectAttributes) {
        Map<String, ?> flashAttributes = ((RedirectAttributes) model).getFlashAttributes();
        HttpServletRequest request = webRequest.getNativeRequest(HttpServletRequest.class);
        RequestContextUtils.getOutputFlashMap(request).putAll(flashAttributes);
    }
    return mav;
}