org.springframework.web.servlet.mvc.method.annotation
Class AbstractMessageConverterMethodProcessor
java.lang.Object
org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver
org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor
- All Implemented Interfaces:
- org.springframework.web.method.support.HandlerMethodArgumentResolver, org.springframework.web.method.support.HandlerMethodReturnValueHandler
- Direct Known Subclasses:
- HttpEntityMethodProcessor, RequestResponseBodyMethodProcessor
public abstract class AbstractMessageConverterMethodProcessor
- extends AbstractMessageConverterMethodArgumentResolver
- implements org.springframework.web.method.support.HandlerMethodReturnValueHandler
Extends AbstractMessageConverterMethodArgumentResolver
with the ability to handle method return
values by writing to the response with HttpMessageConverter
s.
- Since:
- 3.1
- Author:
- Arjen Poutsma, Rossen Stoyanchev
Method Summary |
protected org.springframework.http.server.ServletServerHttpResponse |
createOutputMessage(org.springframework.web.context.request.NativeWebRequest webRequest)
Creates a new HttpOutputMessage from the given NativeWebRequest . |
protected java.util.List<org.springframework.http.MediaType> |
getProducibleMediaTypes(javax.servlet.http.HttpServletRequest request,
java.lang.Class<?> returnValueClass)
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
|
writeWithMessageConverters(T returnValue,
org.springframework.core.MethodParameter returnType,
org.springframework.web.context.request.NativeWebRequest webRequest)
Writes the given return value to the given web request. |
protected
|
writeWithMessageConverters(T returnValue,
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.springframework.web.method.support.HandlerMethodReturnValueHandler |
handleReturnValue, supportsReturnType |
Methods inherited from interface org.springframework.web.method.support.HandlerMethodArgumentResolver |
resolveArgument, supportsParameter |
AbstractMessageConverterMethodProcessor
protected AbstractMessageConverterMethodProcessor(java.util.List<org.springframework.http.converter.HttpMessageConverter<?>> messageConverters)
createOutputMessage
protected org.springframework.http.server.ServletServerHttpResponse createOutputMessage(org.springframework.web.context.request.NativeWebRequest webRequest)
- Creates a new
HttpOutputMessage
from the given NativeWebRequest
.
- Parameters:
webRequest
- the web request to create an output message from
- Returns:
- the output message
writeWithMessageConverters
protected <T> void writeWithMessageConverters(T returnValue,
org.springframework.core.MethodParameter returnType,
org.springframework.web.context.request.NativeWebRequest webRequest)
throws java.io.IOException,
org.springframework.web.HttpMediaTypeNotAcceptableException
- Writes the given return value to the given web request. Delegates to
writeWithMessageConverters(Object, MethodParameter, ServletServerHttpRequest, ServletServerHttpResponse)
- Throws:
java.io.IOException
org.springframework.web.HttpMediaTypeNotAcceptableException
writeWithMessageConverters
protected <T> void writeWithMessageConverters(T returnValue,
org.springframework.core.MethodParameter returnType,
org.springframework.http.server.ServletServerHttpRequest inputMessage,
org.springframework.http.server.ServletServerHttpResponse outputMessage)
throws java.io.IOException,
org.springframework.web.HttpMediaTypeNotAcceptableException
- Writes the given return type to the given output message.
- Parameters:
returnValue
- 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 to
- Throws:
java.io.IOException
- thrown in case of I/O errors
org.springframework.web.HttpMediaTypeNotAcceptableException
- thrown when the conditions indicated by Accept
header on
the request cannot be met by the message converters
getProducibleMediaTypes
protected java.util.List<org.springframework.http.MediaType> getProducibleMediaTypes(javax.servlet.http.HttpServletRequest request,
java.lang.Class<?> returnValueClass)
- 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