类 StandardServletMultipartResolver

  • 所有已实现的接口:
    MultipartResolver

    public class StandardServletMultipartResolver
    extends Object
    implements MultipartResolver
    Standard implementation of the MultipartResolver interface, based on the Servlet 3.0 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 MultipartConfigElement in programmatic servlet registration, or (in case of a custom servlet class) possibly with a 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.

     public class AppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
             // ...
             @Override
             protected void customizeRegistration(ServletRegistration.Dynamic registration) {
         // Optionally also set maxFileSize, maxRequestSize, fileSizeThreshold
         registration.setMultipartConfig(new MultipartConfigElement("/tmp"));
       }
     }
     
    从以下版本开始:
    3.1
    作者:
    Juergen Hoeller
    另请参阅:
    setResolveLazily(boolean), HttpServletRequest.getParts(), CommonsMultipartResolver