类 HttpEntityMethodProcessor
java.lang.Object
cn.taketoday.web.bind.resolver.AbstractMessageConverterMethodArgumentResolver
cn.taketoday.web.bind.resolver.AbstractMessageConverterMethodProcessor
cn.taketoday.web.bind.resolver.HttpEntityMethodProcessor
public class HttpEntityMethodProcessor
extends AbstractMessageConverterMethodProcessor
implements HandlerMethodReturnValueHandler
Resolves
HttpEntity and RequestEntity method argument values
and also handles HttpEntity and ResponseEntity return values.
An HttpEntity return type has a specific purpose. Therefore this
handler should be configured ahead of handlers that support any return
value type annotated with @ModelAttribute or @ResponseBody
to ensure they don't take over.
- 从以下版本开始:
- 4.0 2022/1/23 17:43
- 作者:
- Arjen Poutsma, Rossen Stoyanchev, Brian Clozel, Sam Brannen, Harry Yang
-
嵌套类概要
从类继承的嵌套类/接口 cn.taketoday.web.bind.resolver.AbstractMessageConverterMethodProcessor
AbstractMessageConverterMethodProcessor.ServletDelegate -
字段概要
字段从类继承的字段 cn.taketoday.web.bind.resolver.AbstractMessageConverterMethodArgumentResolver
messageConverters从接口继承的字段 cn.taketoday.web.ReturnValueHandler
NONE_RETURN_VALUE -
构造器概要
构造器构造器说明HttpEntityMethodProcessor(List<HttpMessageConverter<?>> converters, ContentNegotiationManager manager, RedirectModelManager redirectModelManager) Basic constructor with converters andContentNegotiationManager.HttpEntityMethodProcessor(List<HttpMessageConverter<?>> converters, ContentNegotiationManager manager, List<Object> requestResponseBodyAdvice, RedirectModelManager redirectModelManager) Complete constructor for resolvingHttpEntityand handlingResponseEntity.HttpEntityMethodProcessor(List<HttpMessageConverter<?>> converters, RedirectModelManager redirectModelManager) Basic constructor with converters only.HttpEntityMethodProcessor(List<HttpMessageConverter<?>> converters, List<Object> requestResponseBodyAdvice, RedirectModelManager redirectModelManager) Complete constructor for resolvingHttpEntitymethod arguments. -
方法概要
修饰符和类型方法说明private TypegetHttpEntityType(cn.taketoday.core.MethodParameter parameter) protected Class<?>getReturnValueType(Object returnValue, cn.taketoday.core.MethodParameter returnType) Return the type of the value to be written to the response.getVaryRequestHeadersToAdd(HttpHeaders responseHeaders, HttpHeaders entityHeaders) voidhandleReturnValue(RequestContext context, Object handler, Object returnValue) Handle result of the handlerprivate booleanisResourceNotModified(RequestContext context, HttpMethod method) resolveArgument(RequestContext context, ResolvableMethodParameter resolvable) Resolve parameterprivate voidsaveRedirectAttributes(RequestContext request, String location) booleansupportsHandlerMethod(HandlerMethod handlerMethod) 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, isResourceType, writeWithMessageConverters从类继承的方法 cn.taketoday.web.bind.resolver.AbstractMessageConverterMethodArgumentResolver
adaptArgumentIfNecessary, closeStreamIfNecessary, getAdvice, getSupportedMediaTypes, isBindExceptionRequired, readWithMessageConverters, 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
-
字段详细资料
-
redirectModelManager
-
-
构造器详细资料
-
HttpEntityMethodProcessor
public HttpEntityMethodProcessor(List<HttpMessageConverter<?>> converters, @Nullable RedirectModelManager redirectModelManager) Basic constructor with converters only. Suitable for resolvingHttpEntity. For handlingResponseEntityconsider also providing aContentNegotiationManager. -
HttpEntityMethodProcessor
public HttpEntityMethodProcessor(List<HttpMessageConverter<?>> converters, @Nullable ContentNegotiationManager manager, @Nullable RedirectModelManager redirectModelManager) Basic constructor with converters andContentNegotiationManager. Suitable for resolvingHttpEntityand handlingResponseEntitywithoutRequest~orResponseBodyAdvice. -
HttpEntityMethodProcessor
public HttpEntityMethodProcessor(List<HttpMessageConverter<?>> converters, @Nullable List<Object> requestResponseBodyAdvice, @Nullable RedirectModelManager redirectModelManager) Complete constructor for resolvingHttpEntitymethod arguments. For handlingResponseEntityconsider also providing aContentNegotiationManager. -
HttpEntityMethodProcessor
public HttpEntityMethodProcessor(List<HttpMessageConverter<?>> converters, @Nullable ContentNegotiationManager manager, List<Object> requestResponseBodyAdvice, @Nullable RedirectModelManager redirectModelManager) Complete constructor for resolvingHttpEntityand handlingResponseEntity.
-
-
方法详细资料
-
supportsParameter
从接口复制的说明:ParameterResolvingStrategyWhether the given parameter is supported by this resolver.static match
- 指定者:
supportsParameter在接口中ParameterResolvingStrategy
-
resolveArgument
@Nullable public Object resolveArgument(RequestContext context, ResolvableMethodParameter resolvable) throws IOException, HttpMediaTypeNotSupportedException 从接口复制的说明:ParameterResolvingStrategyResolve parameter- 指定者:
resolveArgument在接口中ParameterResolvingStrategy- 参数:
context- Current request contextresolvable- resolvable parameter- 返回:
- method parameter instance
- 抛出:
IOExceptionHttpMediaTypeNotSupportedException- 另请参阅:
-
getHttpEntityType
-
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
-
supportsHandlerMethod
从接口复制的说明:HandlerMethodReturnValueHandlerWhether the given method is supported by this handler.- 指定者:
supportsHandlerMethod在接口中HandlerMethodReturnValueHandler- 返回:
trueif this handler supports the supplied return type;falseotherwise- 另请参阅:
-
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
-
getVaryRequestHeadersToAdd
private List<String> getVaryRequestHeadersToAdd(HttpHeaders responseHeaders, HttpHeaders entityHeaders) -
isResourceNotModified
-
saveRedirectAttributes
-
getReturnValueType
protected Class<?> getReturnValueType(@Nullable Object returnValue, @Nullable cn.taketoday.core.MethodParameter returnType) Return the type of the value to be written to the response. Typically this is a simple check via getClass on the value but if the value is null, then the return type needs to be examined possibly including generic type determination (e.g.ResponseEntity<T>).
-