public abstract class AbstractMessageConverterMethodProcessor extends AbstractMessageConverterMethodArgumentResolver implements org.springframework.web.method.support.HandlerMethodReturnValueHandler
AbstractMessageConverterMethodArgumentResolver
with the ability to handle method
return values by writing to the response with HttpMessageConverters
.allSupportedMediaTypes, logger, messageConverters
Modifier | Constructor and Description |
---|---|
protected |
AbstractMessageConverterMethodProcessor(List<org.springframework.http.converter.HttpMessageConverter<?>> converters)
Constructor with list of converters only.
|
protected |
AbstractMessageConverterMethodProcessor(List<org.springframework.http.converter.HttpMessageConverter<?>> converters,
org.springframework.web.accept.ContentNegotiationManager contentNegotiationManager)
Constructor with list of converters and ContentNegotiationManager.
|
protected |
AbstractMessageConverterMethodProcessor(List<org.springframework.http.converter.HttpMessageConverter<?>> converters,
org.springframework.web.accept.ContentNegotiationManager manager,
List<Object> requestResponseBodyAdvice)
Constructor with list of converters and ContentNegotiationManager as well
as request/response body advice instances.
|
Modifier and Type | Method and Description |
---|---|
protected org.springframework.http.server.ServletServerHttpResponse |
createOutputMessage(org.springframework.web.context.request.NativeWebRequest webRequest)
Creates a new
HttpOutputMessage from the given NativeWebRequest . |
protected List<org.springframework.http.MediaType> |
getProducibleMediaTypes(HttpServletRequest request,
Class<?> valueClass)
Returns the media types that can be produced.
|
protected List<org.springframework.http.MediaType> |
getProducibleMediaTypes(HttpServletRequest request,
Class<?> valueClass,
Type targetType)
Returns the media types that can be produced.
|
protected Class<?> |
getReturnValueType(Object value,
org.springframework.core.MethodParameter returnType)
Return the type of the value to be written to the response.
|
protected boolean |
isResourceType(Object value,
org.springframework.core.MethodParameter returnType)
Return whether the returned value or the declared return type extends
Resource . |
protected <T> void |
writeWithMessageConverters(T value,
org.springframework.core.MethodParameter returnType,
org.springframework.web.context.request.NativeWebRequest webRequest)
Writes the given return value to the given web request.
|
protected <T> void |
writeWithMessageConverters(T value,
org.springframework.core.MethodParameter returnType,
org.springframework.http.server.ServletServerHttpRequest inputMessage,
org.springframework.http.server.ServletServerHttpResponse outputMessage)
Writes the given return type to the given output message.
|
adaptArgumentIfNecessary, createInputMessage, isBindExceptionRequired, readWithMessageConverters, readWithMessageConverters, validateIfApplicable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected AbstractMessageConverterMethodProcessor(List<org.springframework.http.converter.HttpMessageConverter<?>> converters)
protected AbstractMessageConverterMethodProcessor(List<org.springframework.http.converter.HttpMessageConverter<?>> converters, @Nullable org.springframework.web.accept.ContentNegotiationManager contentNegotiationManager)
protected AbstractMessageConverterMethodProcessor(List<org.springframework.http.converter.HttpMessageConverter<?>> converters, @Nullable org.springframework.web.accept.ContentNegotiationManager manager, @Nullable List<Object> requestResponseBodyAdvice)
protected org.springframework.http.server.ServletServerHttpResponse createOutputMessage(org.springframework.web.context.request.NativeWebRequest webRequest)
HttpOutputMessage
from the given NativeWebRequest
.webRequest
- the web request to create an output message fromprotected <T> void writeWithMessageConverters(T value, org.springframework.core.MethodParameter returnType, org.springframework.web.context.request.NativeWebRequest webRequest) throws IOException, org.springframework.web.HttpMediaTypeNotAcceptableException, org.springframework.http.converter.HttpMessageNotWritableException
writeWithMessageConverters(Object, MethodParameter, ServletServerHttpRequest, ServletServerHttpResponse)
IOException
org.springframework.web.HttpMediaTypeNotAcceptableException
org.springframework.http.converter.HttpMessageNotWritableException
protected <T> void writeWithMessageConverters(@Nullable T value, org.springframework.core.MethodParameter returnType, org.springframework.http.server.ServletServerHttpRequest inputMessage, org.springframework.http.server.ServletServerHttpResponse outputMessage) throws IOException, org.springframework.web.HttpMediaTypeNotAcceptableException, org.springframework.http.converter.HttpMessageNotWritableException
value
- the value to write to the output messagereturnType
- the type of the valueinputMessage
- the input messages. Used to inspect the Accept
header.outputMessage
- the output message to write toIOException
- thrown in case of I/O errorsorg.springframework.web.HttpMediaTypeNotAcceptableException
- thrown when the conditions indicated
by the Accept
header on the request cannot be met by the message convertersorg.springframework.http.converter.HttpMessageNotWritableException
- thrown if a given message cannot
be written by a converter, or if the content-type chosen by the server
has no compatible converter.protected Class<?> getReturnValueType(@Nullable Object value, org.springframework.core.MethodParameter returnType)
ResponseEntity<T>
).protected boolean isResourceType(@Nullable Object value, org.springframework.core.MethodParameter returnType)
Resource
.protected List<org.springframework.http.MediaType> getProducibleMediaTypes(HttpServletRequest request, Class<?> valueClass)
protected List<org.springframework.http.MediaType> getProducibleMediaTypes(HttpServletRequest request, Class<?> valueClass, @Nullable Type targetType)
MediaType.ALL