Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-14045

ModelAndView is replaced when a RedirectView is used

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 3.2.16, 4.2.5
    • Fix Version/s: 3.2.17, 4.2.6, 4.3 RC1
    • Component/s: Web
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      I have a HandlerInterceptor that is Doing Things for me based on the contents of the model I populate in a controller. I have a controller that returns a ModelAndView with a RedirectView, filling data into the model to be processed by the interceptor before the redirect fires.

      However, the ModelAndView object is replaced by Spring between the controller return and the interceptor invocation (the objects have different IDs when inspected). The view is copied, but the model is discarded.

      This appears to be a result of interactions between the handler's ignoreDefaultModelOnRedirect and the ModelAndViewContainer; even though a method that returns a ModelAndView is not using the "default" model, the returned model is discarded.

      If a controller method returns an explicit model in a ModelAndView, then that model should be retained even when ignoreDefaultModelOnRedirect is set.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                rstoya05-aop Rossen Stoyanchev
                Reporter:
                w_c_smith Christopher Smith
                Last updater:
                Spring Issuemaster
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  1 year, 1 week, 6 days ago