-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)status: bulk-closedAn outdated, unresolved issue that's closed in bulk as part of a cleaning processAn outdated, unresolved issue that's closed in bulk as part of a cleaning process
Description
Dennis Homann opened SPR-10516 and commented
From comments Rossen's comment on #14054 and his comment on #11462, it seems that the following design is intended:
- to allow fine control over query parameters added automatically during a redirect, handlers should accept an argument of type
RedirectAttributes RedirectAttributesdefine a redirect model, which is separate from the default model (part of theModelAndViewreturned by the handler). Values in the redirect model are intended as query parameters and will therefore be converted to Strings, values in the default model are intended for rendering and may be "complex" i.e. not string-convertible.- it is recommended to set
RequestMappingHandlerAdapter#ignoreDefaultModelOnRedirect=trueto prevent use of the default model for redirects (if noRedirectAttributeswere used by the handler). This is the default.
Issues:
- Unfortunately, in 3.1.2, the default model is copied into the
ModelAndViewContainermodel inModelAndViewMethodReturnValueHandler:76, and when the handler usesRedirectAttributesthis will result in merging the default model into the redirect model.- This violate the separation of the two (issue Spring core JMS pom.xml #1) models
- This triggers conversion of all default model values to Strings which may cause conversion exceptions, depending on the available converters (issue Improve annotation processing thread-safety #2).
- The redirect mechanism provided by the framework should play well with other parts of the framework, in particular
ViewResolvesandRedirectViewsor custom redirectingSmartViews:- When a handler returns a
ModelAndViewwith aRedirectViewor aSmartViewobject (withisRedirect==true), it should be presented the redirect model for "rendering" (or default to the default model, if the handler does not useRedirectAttributesANDignoreDefaultModelOnRedirect=false. Right now, it is presented the default model (with values converted to Strings) merged with the redirect model (issues Fixes https://jira.springsource.org/browse/SPR-7721 #3). - When a handler returns a view name, it will be resolved by a
ViewResolver, which receives a model to make its decision. One could argue what's more useful here: the default model, a potentially existing redirect model, or both. In any case, if there is a default model, the view resolver must have access to the original model values added by the handler. Like the view before, it is presented the default model (with values converted to Strings) merged with the redirect model (issues SPR-7752 - EntityManager proxy now exposes provider specific interface. #4). I have a custom view resolver which is supposed to resolve a view based on a complex model value, which is not possible right now, ifRedirectAttributeswas used by the handler. - If a view resolver returns a
RedirectView(or redirectingSmartView), it should again receive the redirect model.
- When a handler returns a
Affects: 3.2.1
2 votes, 4 watchers
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)status: bulk-closedAn outdated, unresolved issue that's closed in bulk as part of a cleaning processAn outdated, unresolved issue that's closed in bulk as part of a cleaning process