类 RequestBodyAdviceAdapter
- java.lang.Object
- org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdviceAdapter
- 所有已实现的接口:
RequestBodyAdvice
- 直接已知子类:
JsonViewRequestBodyAdvice
public abstract class RequestBodyAdviceAdapter extends Object implements RequestBodyAdvice
A convenient starting point for implementingResponseBodyAdvice
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.- 从以下版本开始:
- 4.2
- 作者:
- Rossen Stoyanchev
构造器概要
构造器 构造器 说明 RequestBodyAdviceAdapter()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 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.从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdvice
supports
构造器详细资料
RequestBodyAdviceAdapter
public RequestBodyAdviceAdapter()
方法详细资料
handleEmptyBody
public Object handleEmptyBody(Object body, HttpInputMessage inputMessage, MethodParameter parameter, Type targetType, Class<? extends HttpMessageConverter<?>> converterType)
The default implementation returns the body that was passed in.- 指定者:
handleEmptyBody
在接口中RequestBodyAdvice
- 参数:
body
- set tonull
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. forHttpEntity<String>
.converterType
- the selected converter type- 返回:
- the value to use or
null
which may then raise anHttpMessageNotReadableException
if the argument is required.
beforeBodyRead
public HttpInputMessage beforeBodyRead(HttpInputMessage inputMessage, MethodParameter parameter, Type targetType, Class<? extends HttpMessageConverter<?>> converterType) throws IOException
The default implementation returns the InputMessage that was passed in.- 指定者:
beforeBodyRead
在接口中RequestBodyAdvice
- 参数:
inputMessage
- the requestparameter
- the target method parametertargetType
- the target type, not necessarily the same as the method parameter type, e.g. forHttpEntity<String>
.converterType
- the converter used to deserialize the body- 返回:
- the input request or a new instance, never
null
- 抛出:
IOException
afterBodyRead
public Object afterBodyRead(Object body, HttpInputMessage inputMessage, MethodParameter parameter, Type targetType, Class<? extends HttpMessageConverter<?>> converterType)
The default implementation returns the body that was passed in.- 指定者:
afterBodyRead
在接口中RequestBodyAdvice
- 参数:
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. forHttpEntity<String>
.converterType
- the converter used to deserialize the body- 返回:
- the same body or a new instance