org.springframework.web.servlet.mvc.method.annotation
Class AbstractMessageConverterMethodArgumentResolver
java.lang.Object
org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver
- All Implemented Interfaces:
- org.springframework.web.method.support.HandlerMethodArgumentResolver
- Direct Known Subclasses:
- AbstractMessageConverterMethodProcessor, RequestPartMethodArgumentResolver
public abstract class AbstractMessageConverterMethodArgumentResolver
- extends java.lang.Object
- implements org.springframework.web.method.support.HandlerMethodArgumentResolver
A base class for resolving method argument values by reading from the body of a request
with HttpMessageConverter
s.
- Since:
- 3.1
- Author:
- Arjen Poutsma, Rossen Stoyanchev
Field Summary |
protected java.util.List<org.springframework.http.MediaType> |
allSupportedMediaTypes
|
protected org.apache.commons.logging.Log |
logger
|
protected java.util.List<org.springframework.http.converter.HttpMessageConverter<?>> |
messageConverters
|
Method Summary |
protected org.springframework.http.server.ServletServerHttpRequest |
createInputMessage(org.springframework.web.context.request.NativeWebRequest webRequest)
Creates a new HttpInputMessage from the given NativeWebRequest . |
protected
|
readWithMessageConverters(org.springframework.http.HttpInputMessage inputMessage,
org.springframework.core.MethodParameter methodParam,
java.lang.Class<T> paramType)
Creates the method argument value of the expected parameter type by reading from the given HttpInputMessage. |
protected
|
readWithMessageConverters(org.springframework.web.context.request.NativeWebRequest webRequest,
org.springframework.core.MethodParameter methodParam,
java.lang.Class<T> paramType)
Creates the method argument value of the expected parameter type by reading from the given request. |
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.HandlerMethodArgumentResolver |
resolveArgument, supportsParameter |
logger
protected final org.apache.commons.logging.Log logger
messageConverters
protected final java.util.List<org.springframework.http.converter.HttpMessageConverter<?>> messageConverters
allSupportedMediaTypes
protected final java.util.List<org.springframework.http.MediaType> allSupportedMediaTypes
AbstractMessageConverterMethodArgumentResolver
public AbstractMessageConverterMethodArgumentResolver(java.util.List<org.springframework.http.converter.HttpMessageConverter<?>> messageConverters)
readWithMessageConverters
protected <T> java.lang.Object readWithMessageConverters(org.springframework.web.context.request.NativeWebRequest webRequest,
org.springframework.core.MethodParameter methodParam,
java.lang.Class<T> paramType)
throws java.io.IOException,
org.springframework.web.HttpMediaTypeNotSupportedException
- Creates the method argument value of the expected parameter type by reading from the given request.
- Type Parameters:
T
- the expected type of the argument value to be created- Parameters:
webRequest
- the current requestmethodParam
- the method argumentparamType
- the type of the argument value to be created
- Returns:
- the created method argument value
- Throws:
java.io.IOException
- if the reading from the request fails
org.springframework.web.HttpMediaTypeNotSupportedException
- if no suitable message converter is found
readWithMessageConverters
protected <T> java.lang.Object readWithMessageConverters(org.springframework.http.HttpInputMessage inputMessage,
org.springframework.core.MethodParameter methodParam,
java.lang.Class<T> paramType)
throws java.io.IOException,
org.springframework.web.HttpMediaTypeNotSupportedException
- Creates the method argument value of the expected parameter type by reading from the given HttpInputMessage.
- Type Parameters:
T
- the expected type of the argument value to be created- Parameters:
inputMessage
- the HTTP input message representing the current requestmethodParam
- the method argumentparamType
- the type of the argument value to be created
- Returns:
- the created method argument value
- Throws:
java.io.IOException
- if the reading from the request fails
org.springframework.web.HttpMediaTypeNotSupportedException
- if no suitable message converter is found
createInputMessage
protected org.springframework.http.server.ServletServerHttpRequest createInputMessage(org.springframework.web.context.request.NativeWebRequest webRequest)
- Creates a new
HttpInputMessage
from the given NativeWebRequest
.
- Parameters:
webRequest
- the web request to create an input message from
- Returns:
- the input message