mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-10-06 23:19:03 +00:00
Support CharSequence for response body
Issue: SPR-13423
This commit is contained in:
+7
@@ -170,6 +170,13 @@ public abstract class AbstractMessageConverterMethodProcessor extends AbstractMe
|
||||
|
||||
Class<?> returnValueClass = getReturnValueType(returnValue, returnType);
|
||||
Type returnValueType = getGenericType(returnType);
|
||||
|
||||
if (returnValue != null && returnValue instanceof CharSequence) {
|
||||
returnValueClass = String.class;
|
||||
returnValueType = String.class;
|
||||
returnValue = (T) returnValue.toString();
|
||||
}
|
||||
|
||||
HttpServletRequest servletRequest = inputMessage.getServletRequest();
|
||||
List<MediaType> requestedMediaTypes = getAcceptableMediaTypes(servletRequest);
|
||||
List<MediaType> producibleMediaTypes = getProducibleMediaTypes(servletRequest, returnValueClass, returnValueType);
|
||||
|
||||
Reference in New Issue
Block a user