public abstract class AbstractMessageConverterMethodArgumentResolver extends Object implements HandlerMethodArgumentResolver
HttpMessageConverters.| Modifier and Type | Field and Description |
|---|---|
protected List<MediaType> |
allSupportedMediaTypes |
protected Log |
logger |
protected List<HttpMessageConverter<?>> |
messageConverters |
| Constructor and Description |
|---|
AbstractMessageConverterMethodArgumentResolver(List<HttpMessageConverter<?>> messageConverters) |
| Modifier and Type | Method and Description |
|---|---|
protected ServletServerHttpRequest |
createInputMessage(NativeWebRequest webRequest)
Create a new
HttpInputMessage from the given NativeWebRequest. |
protected boolean |
isBindExceptionRequired(WebDataBinder binder,
MethodParameter methodParam)
Whether to raise a fatal bind exception on validation errors.
|
protected <T> Object |
readWithMessageConverters(HttpInputMessage inputMessage,
MethodParameter methodParam,
Type targetType)
Create the method argument value of the expected parameter type by reading
from the given HttpInputMessage.
|
protected <T> Object |
readWithMessageConverters(NativeWebRequest webRequest,
MethodParameter methodParam,
Type paramType)
Create the method argument value of the expected parameter type by
reading from the given request.
|
protected void |
validateIfApplicable(WebDataBinder binder,
MethodParameter methodParam)
Validate the request part if applicable.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitresolveArgument, supportsParameterprotected final Log logger
protected final List<HttpMessageConverter<?>> messageConverters
public AbstractMessageConverterMethodArgumentResolver(List<HttpMessageConverter<?>> messageConverters)
protected <T> Object readWithMessageConverters(NativeWebRequest webRequest, MethodParameter methodParam, Type paramType) throws IOException, HttpMediaTypeNotSupportedException
T - the expected type of the argument value to be createdwebRequest - the current requestmethodParam - the method argumentparamType - the type of the argument value to be createdIOException - if the reading from the request failsHttpMediaTypeNotSupportedException - if no suitable message converter is foundprotected <T> Object readWithMessageConverters(HttpInputMessage inputMessage, MethodParameter methodParam, Type targetType) throws IOException, HttpMediaTypeNotSupportedException
T - the expected type of the argument value to be createdinputMessage - the HTTP input message representing the current requestmethodParam - the method parameter descriptortargetType - the type of object to create, not necessarily the same as
the method parameter type (e.g. for HttpEntity<String> method
parameter the target type is String)IOException - if the reading from the request failsHttpMediaTypeNotSupportedException - if no suitable message converter is foundprotected ServletServerHttpRequest createInputMessage(NativeWebRequest webRequest)
HttpInputMessage from the given NativeWebRequest.webRequest - the web request to create an input message fromprotected void validateIfApplicable(WebDataBinder binder, MethodParameter methodParam)
The default implementation checks for @javax.validation.Valid,
Spring's Validated,
and custom annotations whose name starts with "Valid".
binder - the DataBinder to be usedmethodParam - the method parameterisBindExceptionRequired(org.springframework.web.bind.WebDataBinder, org.springframework.core.MethodParameter)protected boolean isBindExceptionRequired(WebDataBinder binder, MethodParameter methodParam)
binder - the data binder used to perform data bindingmethodParam - the method argumenttrue if the next method argument is not of type Errors