public abstract class AbstractMessageConverterMethodProcessor extends AbstractMessageConverterMethodArgumentResolver implements 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(java.util.List<HttpMessageConverter<?>> converters)
Constructor with list of converters only.
|
protected |
AbstractMessageConverterMethodProcessor(java.util.List<HttpMessageConverter<?>> converters,
ContentNegotiationManager contentNegotiationManager)
Constructor with list of converters and ContentNegotiationManager.
|
protected |
AbstractMessageConverterMethodProcessor(java.util.List<HttpMessageConverter<?>> converters,
ContentNegotiationManager manager,
java.util.List<java.lang.Object> requestResponseBodyAdvice)
Constructor with list of converters and ContentNegotiationManager as well
as request/response body advice instances.
|
| Modifier and Type | Method and Description |
|---|---|
protected ServletServerHttpResponse |
createOutputMessage(NativeWebRequest webRequest)
Creates a new
HttpOutputMessage from the given NativeWebRequest. |
protected java.util.List<MediaType> |
getProducibleMediaTypes(HttpServletRequest request,
java.lang.Class<?> valueClass) |
protected java.util.List<MediaType> |
getProducibleMediaTypes(HttpServletRequest request,
java.lang.Class<?> valueClass,
java.lang.reflect.Type declaredType)
Returns the media types that can be produced:
The producible media types specified in the request mappings, or
Media types of configured converters that can write the specific return value, or
MediaType.ALL
|
protected java.lang.Class<?> |
getReturnValueType(java.lang.Object value,
MethodParameter returnType)
Return the type of the value to be written to the response.
|
protected <T> void |
writeWithMessageConverters(T value,
MethodParameter returnType,
NativeWebRequest webRequest)
Writes the given return value to the given web request.
|
protected <T> void |
writeWithMessageConverters(T value,
MethodParameter returnType,
ServletServerHttpRequest inputMessage,
ServletServerHttpResponse outputMessage)
Writes the given return type to the given output message.
|
adaptArgumentIfNecessary, createInputMessage, getAdvice, isBindExceptionRequired, readWithMessageConverters, readWithMessageConverters, validateIfApplicableclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithandleReturnValue, supportsReturnTyperesolveArgument, supportsParameterprotected AbstractMessageConverterMethodProcessor(java.util.List<HttpMessageConverter<?>> converters)
protected AbstractMessageConverterMethodProcessor(java.util.List<HttpMessageConverter<?>> converters, ContentNegotiationManager contentNegotiationManager)
protected AbstractMessageConverterMethodProcessor(java.util.List<HttpMessageConverter<?>> converters, ContentNegotiationManager manager, java.util.List<java.lang.Object> requestResponseBodyAdvice)
protected ServletServerHttpResponse createOutputMessage(NativeWebRequest webRequest)
HttpOutputMessage from the given NativeWebRequest.webRequest - the web request to create an output message fromprotected <T> void writeWithMessageConverters(T value,
MethodParameter returnType,
NativeWebRequest webRequest)
throws java.io.IOException,
HttpMediaTypeNotAcceptableException,
HttpMessageNotWritableException
writeWithMessageConverters(Object, MethodParameter, ServletServerHttpRequest, ServletServerHttpResponse)java.io.IOExceptionHttpMediaTypeNotAcceptableExceptionHttpMessageNotWritableExceptionprotected <T> void writeWithMessageConverters(T value,
MethodParameter returnType,
ServletServerHttpRequest inputMessage,
ServletServerHttpResponse outputMessage)
throws java.io.IOException,
HttpMediaTypeNotAcceptableException,
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 tojava.io.IOException - thrown in case of I/O errorsHttpMediaTypeNotAcceptableException - thrown when the conditions indicated
by the Accept header on the request cannot be met by the message convertersHttpMessageNotWritableExceptionprotected java.lang.Class<?> getReturnValueType(java.lang.Object value,
MethodParameter returnType)
ResponseEntity<T>).protected java.util.List<MediaType> getProducibleMediaTypes(HttpServletRequest request, java.lang.Class<?> valueClass)
protected java.util.List<MediaType> getProducibleMediaTypes(HttpServletRequest request, java.lang.Class<?> valueClass, java.lang.reflect.Type declaredType)
MediaType.ALL