-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Description
Kenny MacLeod opened SPR-5766 and commented
It seems odd and undesirable that the annotation-style of MVC controllers should only make use of HttpMessageConverter on the request, and not the response. Specifically, @RequestBody
-annotated arguments can be resolved using HttpMessageConverter .read(), but there's no support for rendering the response using HttpMessageConverter .write().
This is addressed to some degree in #10100, but I'm focussing here more on writing elegant REST controllers; the controller should be able to take the typed and unmarshalled request body Object, and should be able to return a similarly type Object for marshalling. The ModelAndViewResolver approach suggested in #10100 just doesn't seem right.
Would it be possible for the standard return value resolution logic to consult with any HttpMessageConverters in the context, as happens with @RequestBody
annotations? There doesn't seem to be a need for a @ResponseBody
annotation.
Affects: 3.0 M3
Issue Links:
- Allow for custom processing or result objects returned from handler/controller methods [SPR-5426] #10100 Allow for custom processing or result objects returned from handler/controller methods