类 RequestPartMethodArgumentResolver

java.lang.Object
cn.taketoday.web.bind.resolver.AbstractMessageConverterMethodArgumentResolver
cn.taketoday.web.bind.resolver.RequestPartMethodArgumentResolver
所有已实现的接口:
ParameterResolvingStrategy

public class RequestPartMethodArgumentResolver extends AbstractMessageConverterMethodArgumentResolver
Resolves the following method arguments:
  • Annotated with @RequestPart
  • Of type MultipartFile
  • Of type jakarta.servlet.http.Part in 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