类 RequestResponseBodyMethodProcessor
java.lang.Object
cn.taketoday.web.bind.resolver.AbstractMessageConverterMethodArgumentResolver
cn.taketoday.web.bind.resolver.AbstractMessageConverterMethodProcessor
cn.taketoday.web.bind.resolver.RequestResponseBodyMethodProcessor
public class RequestResponseBodyMethodProcessor
extends AbstractMessageConverterMethodProcessor
implements HandlerMethodReturnValueHandler
Resolves method arguments annotated with
@RequestBody and handles return
values from methods annotated with @ResponseBody by reading and writing
to the body of the request or response with an HttpMessageConverter.- 从以下版本开始:
- 4.0 2022/1/23 17:14
- 作者:
- Arjen Poutsma, Rossen Stoyanchev, Juergen Hoeller, Harry Yang
-
嵌套类概要
从类继承的嵌套类/接口 cn.taketoday.web.bind.resolver.AbstractMessageConverterMethodProcessor
AbstractMessageConverterMethodProcessor.ServletDelegate -
字段概要
从类继承的字段 cn.taketoday.web.bind.resolver.AbstractMessageConverterMethodArgumentResolver
messageConverters从接口继承的字段 cn.taketoday.web.ReturnValueHandler
NONE_RETURN_VALUE -
构造器概要
构造器构造器说明RequestResponseBodyMethodProcessor(List<HttpMessageConverter<?>> converters) Basic constructor with converters only.RequestResponseBodyMethodProcessor(List<HttpMessageConverter<?>> converters, ContentNegotiationManager manager) Basic constructor with converters andContentNegotiationManager.RequestResponseBodyMethodProcessor(List<HttpMessageConverter<?>> converters, ContentNegotiationManager manager, List<Object> requestResponseBodyAdvice) Complete constructor for resolving@RequestBodyand handling@ResponseBody.RequestResponseBodyMethodProcessor(List<HttpMessageConverter<?>> converters, List<Object> requestResponseBodyAdvice) Complete constructor for resolving@RequestBodymethod arguments. -
方法概要
修饰符和类型方法说明protected booleancheckRequired(cn.taketoday.core.MethodParameter parameter) voidhandleReturnValue(RequestContext context, Object handler, Object returnValue) Handle result of the handlerprotected ObjectreadWithMessageConverters(RequestContext request, cn.taketoday.core.MethodParameter parameter, Type paramType) Create the method argument value of the expected parameter type by reading from the given request.resolveArgument(RequestContext context, ResolvableMethodParameter resolvable) Throws MethodArgumentNotValidException if validation fails.booleansupportsHandlerMethod(HandlerMethod handler) Whether the given method is supported by this handler.booleansupportsParameter(ResolvableMethodParameter resolvable) Whether the given parameter is supported by this resolver.booleansupportsReturnValue(Object returnValue) If thisReturnValueHandlersupports the target handler's result从类继承的方法 cn.taketoday.web.bind.resolver.AbstractMessageConverterMethodProcessor
getProducibleMediaTypes, getProducibleMediaTypes, getReturnValueType, isResourceType, writeWithMessageConverters从类继承的方法 cn.taketoday.web.bind.resolver.AbstractMessageConverterMethodArgumentResolver
adaptArgumentIfNecessary, closeStreamIfNecessary, getAdvice, getSupportedMediaTypes, isBindExceptionRequired, readWithMessageConverters, validateIfApplicable, validateIfApplicable从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 cn.taketoday.web.handler.result.HandlerMethodReturnValueHandler
handleHandlerMethodReturnValue, supportsHandler
-
构造器详细资料
-
RequestResponseBodyMethodProcessor
Basic constructor with converters only. Suitable for resolving@RequestBody. For handling@ResponseBodyconsider also providing aContentNegotiationManager. -
RequestResponseBodyMethodProcessor
public RequestResponseBodyMethodProcessor(List<HttpMessageConverter<?>> converters, @Nullable ContentNegotiationManager manager) Basic constructor with converters andContentNegotiationManager. Suitable for resolving@RequestBodyand handling@ResponseBodywithoutRequest~orResponseBodyAdvice. -
RequestResponseBodyMethodProcessor
public RequestResponseBodyMethodProcessor(List<HttpMessageConverter<?>> converters, @Nullable List<Object> requestResponseBodyAdvice) Complete constructor for resolving@RequestBodymethod arguments. For handling@ResponseBodyconsider also providing aContentNegotiationManager. -
RequestResponseBodyMethodProcessor
public RequestResponseBodyMethodProcessor(List<HttpMessageConverter<?>> converters, @Nullable ContentNegotiationManager manager, @Nullable List<Object> requestResponseBodyAdvice) Complete constructor for resolving@RequestBodyand handling@ResponseBody.
-
-
方法详细资料
-
supportsParameter
从接口复制的说明:ParameterResolvingStrategyWhether the given parameter is supported by this resolver.static match
- 指定者:
supportsParameter在接口中ParameterResolvingStrategy
-
resolveArgument
@Nullable public Object resolveArgument(RequestContext context, ResolvableMethodParameter resolvable) throws Throwable Throws MethodArgumentNotValidException if validation fails.- 指定者:
resolveArgument在接口中ParameterResolvingStrategy- 参数:
context- Current request contextresolvable- resolvable parameter- 返回:
- method parameter instance
- 抛出:
HttpMessageNotReadableException- ifRequestBody.required()istrueand there is no body content or if there is no suitable converter to read the content with.Throwable- if anyExceptionoccurred- 另请参阅:
-
readWithMessageConverters
protected Object readWithMessageConverters(RequestContext request, cn.taketoday.core.MethodParameter parameter, Type paramType) throws IOException, HttpMediaTypeNotSupportedException, HttpMessageNotReadableException Create the method argument value of the expected parameter type by reading from the given request.- 覆盖:
readWithMessageConverters在类中AbstractMessageConverterMethodArgumentResolver- 参数:
request- the current requestparameter- the method parameter descriptor (may benull)paramType- the type of the argument value to be created- 返回:
- the created method argument value
- 抛出:
IOException- if the reading from the request failsHttpMediaTypeNotSupportedException- if no suitable message converter is foundHttpMessageNotReadableException
-
checkRequired
protected boolean checkRequired(cn.taketoday.core.MethodParameter parameter) -
supportsHandlerMethod
从接口复制的说明:HandlerMethodReturnValueHandlerWhether the given method is supported by this handler.- 指定者:
supportsHandlerMethod在接口中HandlerMethodReturnValueHandler- 返回:
trueif this handler supports the supplied return type;falseotherwise- 另请参阅:
-
supportsReturnValue
从接口复制的说明:ReturnValueHandlerIf thisReturnValueHandlersupports the target handler's resultThis method can test this
ReturnValueHandlersupports the target handler in application runtime- 指定者:
supportsReturnValue在接口中ReturnValueHandler- 参数:
returnValue- Target handler's return-value or result- 返回:
- If this
ReturnValueHandlersupports the target handler's result
-
handleReturnValue
public void handleReturnValue(RequestContext context, @Nullable Object handler, @Nullable Object returnValue) throws Exception 从接口复制的说明:HandlerMethodReturnValueHandlerHandle result of the handler- 指定者:
handleReturnValue在接口中HandlerMethodReturnValueHandler- 指定者:
handleReturnValue在接口中ReturnValueHandler- 参数:
context- Current HTTP request contexthandler- handler may be HandlerMethodreturnValue- Handler execution result OrHandlerExceptionHandlerreturn value- 抛出:
Exception- return-value handled failed
-