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

Package org.springframework.web.multipart.support

Types

ByteArrayMultipartFileEditor

open class ByteArrayMultipartFileEditor : ByteArrayPropertyEditor

Custom java.beans.PropertyEditor for converting MultipartFile to byte arrays.

DefaultMultipartHttpServletRequest

open class DefaultMultipartHttpServletRequest : AbstractMultipartHttpServletRequest

Default implementation of the org.springframework.web.multipart.MultipartHttpServletRequest interface. Provides management of pre-generated parameter values.

Used by org.springframework.web.multipart.commons.CommonsMultipartResolver.

MultipartFilter

open class MultipartFilter : OncePerRequestFilter

Servlet Filter that resolves multipart requests via a MultipartResolver. in the root web application context.

Looks up the MultipartResolver in Spring's root web application context. Supports a "multipartResolverBeanName" filter init-param in web.xml; the default bean name is "filterMultipartResolver".

If no MultipartResolver bean is found, this filter falls back to a default MultipartResolver: StandardServletMultipartResolver for Servlet 3.0, based on a multipart-config section in web.xml. Note however that at present the Servlet specification only defines how to enable multipart configuration on a Servlet and as a result multipart request processing is likely not possible in a Filter unless the Servlet container provides a workaround such as Tomcat's "allowCasualMultipartParsing" property.

MultipartResolver lookup is customizable: Override this filter's lookupMultipartResolver method to use a custom MultipartResolver instance, for example if not using a Spring web application context. Note that the lookup method should not create a new MultipartResolver instance for each call but rather return a reference to a pre-built instance.

Note: This filter is an alternative to using DispatcherServlet's MultipartResolver support, for example for web applications with custom web views which do not use Spring's web MVC, or for custom filters applied before a Spring MVC DispatcherServlet (e.g. org.springframework.web.filter.HiddenHttpMethodFilter). In any case, this filter should not be combined with servlet-specific multipart resolution.

MultipartResolutionDelegate

abstract class MultipartResolutionDelegate

A common delegate for HandlerMethodArgumentResolver implementations which need to resolve MultipartFile and Part arguments.

RequestPartServletServerHttpRequest

open class RequestPartServletServerHttpRequest : ServletServerHttpRequest

ServerHttpRequest implementation that accesses one part of a multipart request. If using MultipartResolver configuration the part is accessed through a MultipartFile. Or if using Servlet 3.0 multipart processing the part is accessed through ServletRequest.getPart.

StandardMultipartHttpServletRequest

open class StandardMultipartHttpServletRequest : AbstractMultipartHttpServletRequest

Spring MultipartHttpServletRequest adapter, wrapping a Servlet 3.0 HttpServletRequest and its Part objects. Parameters get exposed through the native request's getParameter methods - without any custom processing on our side.

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.

StringMultipartFileEditor

open class StringMultipartFileEditor : PropertyEditorSupport

Custom java.beans.PropertyEditor for converting MultipartFile to Strings.

Allows one to specify the charset to use.

Exceptions

MissingServletRequestPartException

open class MissingServletRequestPartException : ServletException

Raised when the part of a "multipart/form-data" request identified by its name cannot be found.

This may be because the request is not a multipart/form-data request, because the part is not present in the request, or because the web application is not configured correctly for processing multipart requests, e.g. no MultipartResolver.