Example usage for org.springframework.web.method.support ModelAndViewContainer getDefaultModel

List of usage examples for org.springframework.web.method.support ModelAndViewContainer getDefaultModel

Introduction

In this page you can find the example usage for org.springframework.web.method.support ModelAndViewContainer getDefaultModel.

Prototype

public ModelMap getDefaultModel() 

Source Link

Document

Return the "default" model created at instantiation.

Usage

From source file:org.springframework.web.method.annotation.ModelFactory.java

/**
 * Promote model attributes listed as {@code @SessionAttributes} to the session.
 * Add {@link BindingResult} attributes where necessary.
 * @param request the current request/*from  w  w w .ja  v a2 s. c o  m*/
 * @param container contains the model to update
 * @throws Exception if creating BindingResult attributes fails
 */
public void updateModel(NativeWebRequest request, ModelAndViewContainer container) throws Exception {
    ModelMap defaultModel = container.getDefaultModel();
    if (container.getSessionStatus().isComplete()) {
        this.sessionAttributesHandler.cleanupAttributes(request);
    } else {
        this.sessionAttributesHandler.storeAttributes(request, defaultModel);
    }
    if (!container.isRequestHandled() && container.getModel() == defaultModel) {
        updateBindingResult(request, defaultModel);
    }
}