类 RequestPartMethodArgumentResolver
- 所有已实现的接口:
ParameterResolvingStrategy
- Annotated with @
RequestPart - Of type
MultipartFile - Of type
jakarta.servlet.http.Partin conjunction with Servlet multipart requests
When a parameter is annotated with @RequestPart, the content of the part is
passed through an HttpMessageConverter to resolve the method argument with the
'Content-Type' of the request part in mind. This is analogous to what @RequestBody
does to resolve an argument based on the content of a regular request.
When a parameter is not annotated with @RequestPart or the name of
the part is not specified, the request part's name is derived from the name of
the method argument.
Automatic validation may be applied if the argument is annotated with any
annotations that trigger validation. In case of validation failure, a
MethodArgumentNotValidException is raised and a 400 response status code returned if the
SimpleHandlerExceptionHandler
is configured.
- 从以下版本开始:
- 4.0 2022/4/28 15:32
- 作者:
- Rossen Stoyanchev, Brian Clozel, Juergen Hoeller, Harry Yang
-
字段概要
从类继承的字段 cn.taketoday.web.bind.resolver.AbstractMessageConverterMethodArgumentResolver
messageConverters -
构造器概要
构造器构造器说明RequestPartMethodArgumentResolver(List<HttpMessageConverter<?>> messageConverters) Basic constructor with converters only.RequestPartMethodArgumentResolver(List<HttpMessageConverter<?>> messageConverters, List<Object> requestResponseBodyAdvice) Constructor with converters andRequestBodyAdviceandResponseBodyAdvice. -
方法概要
修饰符和类型方法说明(专用程序包) voidAllow for closing the body stream if necessary, e.g. for part streams in a multipart request.private StringgetPartName(cn.taketoday.core.MethodParameter methodParam, RequestPart requestPart) resolveArgument(RequestContext context, ResolvableMethodParameter resolvable) Resolve parameterbooleansupportsParameter(ResolvableMethodParameter parameter) Whether the given method parameter is supported as multi-part.从类继承的方法 cn.taketoday.web.bind.resolver.AbstractMessageConverterMethodArgumentResolver
adaptArgumentIfNecessary, getAdvice, getSupportedMediaTypes, isBindExceptionRequired, readWithMessageConverters, readWithMessageConverters, validateIfApplicable, validateIfApplicable
-
构造器详细资料
-
RequestPartMethodArgumentResolver
Basic constructor with converters only. -
RequestPartMethodArgumentResolver
public RequestPartMethodArgumentResolver(List<HttpMessageConverter<?>> messageConverters, List<Object> requestResponseBodyAdvice) Constructor with converters andRequestBodyAdviceandResponseBodyAdvice.
-
-
方法详细资料
-
supportsParameter
Whether the given method parameter is supported as multi-part. Supports the following method parameters:- annotated with
@RequestPart - of type
MultipartFileunless annotated with@RequestParam - of type
jakarta.servlet.http.Partunless annotated with@RequestParam
- annotated with
-
resolveArgument
@Nullable public Object resolveArgument(RequestContext context, ResolvableMethodParameter resolvable) throws Throwable 从接口复制的说明:ParameterResolvingStrategyResolve parameter -
getPartName
private String getPartName(cn.taketoday.core.MethodParameter methodParam, @Nullable RequestPart requestPart) -
closeStreamIfNecessary
Allow for closing the body stream if necessary, e.g. for part streams in a multipart request.
-