You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
resolveRequestBody algorithm does not take into account ConversionService when determining if binding is possible [SPR-6729] #11395
in: webIssues in web modules (web, webmvc, webflux, websocket)status: declinedA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancement
I noticed this when using @RequestBody on an Account JavaBean @Controller parameter, when the ContentType of my POST /accounts request was "application/x-www-form-urlencoded". In this case, the resolved FormHttpMessageConverter is only capable of reading a MultiValueMap, not an Account, so I get a 415 back due to a HttpMediaTypeNotSupportedException. However, the ConversionService configured with Spring MVC may be capable of mapping a MultiValueMap to a JavaBean, but it is never queried inside resolveRequestBody of AnnotationMethodHandlerAdapter. If the ConversionService is capable of such a mapping, should it be invoked to allow the Account binding to succeed? Or should it be the sole responsibility of the MessageConverter to determine if binding is possible?
Given the relationship with #11397, I would tend to think whether the ConversionService was used or not would be an implementation detail of the MessageConverter. Something to think about.
If you have this often enough, consider creating your own annotation and implementing a custom HandlerMethodArgumentResolver probably extending from AbstractMessageConverterMethodProcessor.
in: webIssues in web modules (web, webmvc, webflux, websocket)status: declinedA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancement
Activity
spring-projects-issues commentedon Jan 20, 2010
Keith Donald commented
Given the relationship with #11397, I would tend to think whether the ConversionService was used or not would be an implementation detail of the MessageConverter. Something to think about.
spring-projects-issues commentedon Feb 17, 2011
Bryan Kelly commented
Is there currently a work around to this issue when using 3.0.5 of spring-web?
spring-projects-issues commentedon Jun 7, 2011
Rossen Stoyanchev commented
Turning a MultiValueMap into a typed object seems more like data binding. You could do:
If you have this often enough, consider creating your own annotation and implementing a custom HandlerMethodArgumentResolver probably extending from AbstractMessageConverterMethodProcessor.
spring-projects-issues commentedon Jun 8, 2011
Rossen Stoyanchev commented
Better yet, just use
@ModelAttribute! (see #13063)