public abstract class RequestBodyAdviceAdapter extends Object implements RequestBodyAdvice
ResponseBodyAdvice with default method implementations.
Sub-classes are required to implement RequestBodyAdvice.supports(org.springframework.core.MethodParameter, java.lang.reflect.Type, java.lang.Class<? extends org.springframework.http.converter.HttpMessageConverter<?>>) to return true
depending on when the advice applies.
| Constructor and Description |
|---|
RequestBodyAdviceAdapter() |
| Modifier and Type | Method and Description |
|---|---|
Object |
afterBodyRead(Object body,
HttpInputMessage inputMessage,
MethodParameter parameter,
Type targetType,
Class<? extends HttpMessageConverter<?>> converterType)
The default implementation returns the body that was passed in.
|
HttpInputMessage |
beforeBodyRead(HttpInputMessage inputMessage,
MethodParameter parameter,
Type targetType,
Class<? extends HttpMessageConverter<?>> converterType)
The default implementation returns the InputMessage that was passed in.
|
Object |
handleEmptyBody(Object body,
HttpInputMessage inputMessage,
MethodParameter parameter,
Type targetType,
Class<? extends HttpMessageConverter<?>> converterType)
The default implementation returns the body that was passed in.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsupportspublic Object handleEmptyBody(Object body, HttpInputMessage inputMessage, MethodParameter parameter, Type targetType, Class<? extends HttpMessageConverter<?>> converterType)
handleEmptyBody in interface RequestBodyAdvicebody - 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.public HttpInputMessage beforeBodyRead(HttpInputMessage inputMessage, MethodParameter parameter, Type targetType, Class<? extends HttpMessageConverter<?>> converterType) throws IOException
beforeBodyRead in interface RequestBodyAdviceinputMessage - 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 bodynullIOExceptionpublic Object afterBodyRead(Object body, HttpInputMessage inputMessage, MethodParameter parameter, Type targetType, Class<? extends HttpMessageConverter<?>> converterType)
afterBodyRead in interface RequestBodyAdvicebody - 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