spring-framework / org.springframework.web.multipart.support / StandardServletMultipartResolver

StandardServletMultipartResolver

open class StandardServletMultipartResolver : MultipartResolver

Standard implementation of the MultipartResolver interface, based on the Servlet 3.0 javax.servlet.http.Part API. To be added as "multipartResolver" bean to a Spring DispatcherServlet context, without any extra configuration at the bean level (see below).

Note: In order to use Servlet 3.0 based multipart parsing, you need to mark the affected servlet with a "multipart-config" section in web.xml, or with a javax.servlet.MultipartConfigElement in programmatic servlet registration, or (in case of a custom servlet class) possibly with a javax.servlet.annotation.MultipartConfig annotation on your servlet class. Configuration settings such as maximum sizes or storage locations need to be applied at that servlet registration level; Servlet 3.0 does not allow for them to be set at the MultipartResolver level.

Author
Juergen Hoeller

Since
3.1

See Also
#setResolveLazilyHttpServletRequest#getParts()org.springframework.web.multipart.commons.CommonsMultipartResolver

Constructors

<init>

StandardServletMultipartResolver()

Standard implementation of the MultipartResolver interface, based on the Servlet 3.0 javax.servlet.http.Part API. To be added as "multipartResolver" bean to a Spring DispatcherServlet context, without any extra configuration at the bean level (see below).

Note: In order to use Servlet 3.0 based multipart parsing, you need to mark the affected servlet with a "multipart-config" section in web.xml, or with a javax.servlet.MultipartConfigElement in programmatic servlet registration, or (in case of a custom servlet class) possibly with a javax.servlet.annotation.MultipartConfig annotation on your servlet class. Configuration settings such as maximum sizes or storage locations need to be applied at that servlet registration level; Servlet 3.0 does not allow for them to be set at the MultipartResolver level.

Functions

cleanupMultipart

open fun cleanupMultipart(request: MultipartHttpServletRequest): Unit

isMultipart

open fun isMultipart(request: HttpServletRequest): Boolean

resolveMultipart

open fun resolveMultipart(request: HttpServletRequest): MultipartHttpServletRequest

setResolveLazily

open fun setResolveLazily(resolveLazily: Boolean): Unit

Set whether to resolve the multipart request lazily at the time of file or parameter access.

Default is "false", resolving the multipart elements immediately, throwing corresponding exceptions at the time of the #resolveMultipart call. Switch this to "true" for lazy multipart parsing, throwing parse exceptions once the application attempts to obtain multipart files or parameters.