@Target(value=PARAMETER) @Retention(value=RUNTIME) @Documented public @interface RequestPart
MultipartFilein conjunction with Spring's
javax.servlet.http.Partin conjunction with Servlet 3.0 multipart requests, or otherwise for any other method argument, the content of the part is passed through an
HttpMessageConvertertaking into consideration the 'Content-Type' header of the request part. This is analogous to what @
RequestBodydoes to resolve an argument based on the content of a non-multipart regular request.
Note that @
RequestParam annotation can also be used to associate the
part of a "multipart/form-data" request with a method argument supporting the same
method argument types. The main difference is that when the method argument is not a
RequestParam relies on type conversion via a registered
PropertyEditor while @
HttpMessageConverters taking into consideration the 'Content-Type' header
of the request part. @
RequestParam is likely to be used with name-value form
fields while @
RequestPart is likely to be used with parts containing more
complex content (e.g. JSON, XML).
public abstract java.lang.String value
public abstract boolean required
true, leading to an exception thrown in case
of the part missing in the request. Switch this to
if you prefer a
null in case of the part missing.