-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
Christopher Smith opened SPR-14045 and commented
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.
Affects: 3.2.16, 4.2.5
Issue Links:
- @SessionAttributes not populated when going directly to POST and redirecting while ignoreDefaultModelOnRedirect=true [SPR-12542] #17146
@SessionAttributesnot populated when going directly to POST and redirecting while ignoreDefaultModelOnRedirect=true
Referenced from: commits 9e3bb1e, 5828648, d7062f6
Backported to: 3.2.17