public interface RequestBodyAdvice
@RequestBody or an
HttpEntity method argument.
Implementations of this contract may be registered directly with the
RequestMappingHandlerAdapter or more likely annotated with
@ControllerAdvice in which case they are auto-detected.
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
afterBodyRead(java.lang.Object body,
org.springframework.http.HttpInputMessage inputMessage,
org.springframework.core.MethodParameter parameter,
java.lang.reflect.Type targetType,
java.lang.Class<? extends org.springframework.http.converter.HttpMessageConverter<?>> converterType)
Invoked third (and last) after the request body is converted to an Object.
|
org.springframework.http.HttpInputMessage |
beforeBodyRead(org.springframework.http.HttpInputMessage inputMessage,
org.springframework.core.MethodParameter parameter,
java.lang.reflect.Type targetType,
java.lang.Class<? extends org.springframework.http.converter.HttpMessageConverter<?>> converterType)
Invoked second before the request body is read and converted.
|
java.lang.Object |
handleEmptyBody(java.lang.Object body,
org.springframework.http.HttpInputMessage inputMessage,
org.springframework.core.MethodParameter parameter,
java.lang.reflect.Type targetType,
java.lang.Class<? extends org.springframework.http.converter.HttpMessageConverter<?>> converterType)
Invoked second (and last) if the body is empty.
|
boolean |
supports(org.springframework.core.MethodParameter methodParameter,
java.lang.reflect.Type targetType,
java.lang.Class<? extends org.springframework.http.converter.HttpMessageConverter<?>> converterType)
Invoked first to determine if this interceptor applies.
|
boolean supports(org.springframework.core.MethodParameter methodParameter,
java.lang.reflect.Type targetType,
java.lang.Class<? extends org.springframework.http.converter.HttpMessageConverter<?>> converterType)
methodParameter - the method parametertargetType - the target type, not necessarily the same as the method
parameter type, e.g. for HttpEntity<String>.converterType - the selected converter typejava.lang.Object handleEmptyBody(java.lang.Object body,
org.springframework.http.HttpInputMessage inputMessage,
org.springframework.core.MethodParameter parameter,
java.lang.reflect.Type targetType,
java.lang.Class<? extends org.springframework.http.converter.HttpMessageConverter<?>> converterType)
body - set to null before the first advice is calledinputMessage - the requestparameter - the method parametertargetType - the target type, not necessarily the same as the method
parameter type, e.g. for HttpEntity<String>.converterType - the selected converter typenull which may then raise an
HttpMessageNotReadableException if the argument is required.org.springframework.http.HttpInputMessage beforeBodyRead(org.springframework.http.HttpInputMessage inputMessage,
org.springframework.core.MethodParameter parameter,
java.lang.reflect.Type targetType,
java.lang.Class<? extends org.springframework.http.converter.HttpMessageConverter<?>> converterType)
throws java.io.IOException
inputMessage - the requestparameter - the target method parametertargetType - the target type, not necessarily the same as the method
parameter type, e.g. for HttpEntity<String>.converterType - the converter used to deserialize the bodynulljava.io.IOExceptionjava.lang.Object afterBodyRead(java.lang.Object body,
org.springframework.http.HttpInputMessage inputMessage,
org.springframework.core.MethodParameter parameter,
java.lang.reflect.Type targetType,
java.lang.Class<? extends org.springframework.http.converter.HttpMessageConverter<?>> converterType)
body - set to the converter Object before the 1st advice is calledinputMessage - the requestparameter - the target method parametertargetType - the target type, not necessarily the same as the method
parameter type, e.g. for HttpEntity<String>.converterType - the converter used to deserialize the body