Generated by
JDiff

org.springframework.web.multipart Documentation Differences

This file contains all the changes in documentation in the package org.springframework.web.multipart as colored differences. Deletions are shown like this, and additions are shown like this.
If no deletions or additions are shown in an entry, the HTML tags will be what has changed. The new HTML tags are shown in the differences. If no documentation existed, and then some was added in a later version, this change is noted in the appropriate class pages of differences, but the change is not shown on this page. Only changes in existing text are shown here. Similarly, documentation which was inherited from another class or interface is not shown here.
Note that an HTML error in the new documentation may cause the display of other documentation changes to be presented incorrectly. For instance, failure to close a <code> tag will cause all subsequent paragraphs to be displayed differently.

Class MultipartResolver

A strategy interface for multipart file upload resolution in accordance with RFC 1867. Implementations are typically usable both within an application context and standalone.

There is onlyare onetwo concrete implementationimplementations included in Spring, as of Spring 23.51:

There is no default resolver implementation used for Spring DispatcherServlets, as an application might choose to parse its multipart requests itself. To define an implementation, create a bean with the id "multipartResolver" in a DispatcherServlet's application context. Such a resolver gets applied to all requests handled by that org.springframework.web.servlet.DispatcherServlet.

If a org.springframework.web.servlet.DispatcherServlet detects a multipart request, it will resolve it via the configured org.springframework.web.multipart.MultipartResolver and pass on a wrapped javax.servlet.http.HttpServletRequest. Controllers can then cast their given request to the org.springframework.web.multipart.MultipartHttpServletRequest interface, which permits access to any MultipartFiles. Note that this cast is only supported in case of an actual multipart request.

 public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) {
   MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
   MultipartFile multipartFile = multipartRequest.getFile("image");
   ...
 }
Instead of direct access, command or form controllers can register a org.springframework.web.multipart.support.ByteArrayMultipartFileEditor or org.springframework.web.multipart.support.StringMultipartFileEditor with their data binder, to automatically apply multipart content to command bean properties.

As an alternative to using a org.springframework.web.multipart.MultipartResolver with a org.springframework.web.servlet.DispatcherServlet, a org.springframework.web.multipart.support.MultipartFilter can be registered in web.xml. It will delegate to a corresponding org.springframework.web.multipart.MultipartResolver bean in the root application context. This is mainly intended for applications that do not use Spring's own web MVC framework.

Note: There is hardly ever a need to access the org.springframework.web.multipart.MultipartResolver itself from application code. It will simply do its work behind the scenes, making MultipartHttpServletRequests available to controllers. @author Juergen Hoeller @author Trevor D. Cook @since 29.09.2003 @see MultipartHttpServletRequest @see MultipartFile @see org.springframework.web.multipart.commons.CommonsMultipartResolver @see org.springframework.web.multipart.support.ByteArrayMultipartFileEditor @see org.springframework.web.multipart.support.StringMultipartFileEditor @see org.springframework.web.servlet.DispatcherServlet