public class StandardServletMultipartResolver extends Object implements MultipartResolver
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.
Constructor and Description |
---|
StandardServletMultipartResolver() |
Modifier and Type | Method and Description |
---|---|
void |
cleanupMultipart(MultipartHttpServletRequest request)
Cleanup any resources used for the multipart handling,
like a storage for the uploaded files.
|
boolean |
isMultipart(javax.servlet.http.HttpServletRequest request)
Determine if the given request contains multipart content.
|
MultipartHttpServletRequest |
resolveMultipart(javax.servlet.http.HttpServletRequest request)
Parse the given HTTP request into multipart files and parameters,
and wrap the request inside a
MultipartHttpServletRequest object
that provides access to file descriptors and makes contained
parameters accessible via the standard ServletRequest methods. |
public boolean isMultipart(javax.servlet.http.HttpServletRequest request)
MultipartResolver
Will typically check for content type "multipart/form-data", but the actually accepted requests might depend on the capabilities of the resolver implementation.
isMultipart
in interface MultipartResolver
request
- the servlet request to be evaluatedpublic MultipartHttpServletRequest resolveMultipart(javax.servlet.http.HttpServletRequest request) throws MultipartException
MultipartResolver
MultipartHttpServletRequest
object
that provides access to file descriptors and makes contained
parameters accessible via the standard ServletRequest methods.resolveMultipart
in interface MultipartResolver
request
- the servlet request to wrap (must be of a multipart content type)MultipartException
- if the servlet request is not multipart, or if
implementation-specific problems are encountered (such as exceeding file size limits)MultipartRequest.getFile(java.lang.String)
,
MultipartRequest.getFileNames()
,
MultipartRequest.getFileMap()
,
ServletRequest.getParameter(java.lang.String)
,
ServletRequest.getParameterNames()
,
ServletRequest.getParameterMap()
public void cleanupMultipart(MultipartHttpServletRequest request)
MultipartResolver
cleanupMultipart
in interface MultipartResolver
request
- the request to cleanup resources forCopyright © 2015. All rights reserved.