类 StandardServletMultipartResolver
- java.lang.Object
- org.springframework.web.multipart.support.StandardServletMultipartResolver
- 所有已实现的接口:
MultipartResolver
public class StandardServletMultipartResolver extends Object implements MultipartResolver
Standard implementation of theMultipartResolver
interface, based on the Servlet 3.0Part
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 aMultipartConfigElement
in programmatic servlet registration, or (in case of a custom servlet class) possibly with aMultipartConfig
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.- 从以下版本开始:
- 3.1
- 作者:
- Juergen Hoeller
- 另请参阅:
setResolveLazily(boolean)
,HttpServletRequest.getParts()
,CommonsMultipartResolver
构造器概要
构造器 构造器 说明 StandardServletMultipartResolver()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
cleanupMultipart(MultipartHttpServletRequest request)
Cleanup any resources used for the multipart handling, like a storage for the uploaded files.boolean
isMultipart(HttpServletRequest request)
Determine if the given request contains multipart content.MultipartHttpServletRequest
resolveMultipart(HttpServletRequest request)
Parse the given HTTP request into multipart files and parameters, and wrap the request inside aMultipartHttpServletRequest
object that provides access to file descriptors and makes contained parameters accessible via the standard ServletRequest methods.void
setResolveLazily(boolean resolveLazily)
Set whether to resolve the multipart request lazily at the time of file or parameter access.
构造器详细资料
StandardServletMultipartResolver
public StandardServletMultipartResolver()
方法详细资料
setResolveLazily
public void setResolveLazily(boolean resolveLazily)
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(javax.servlet.http.HttpServletRequest)
call. Switch this to "true" for lazy multipart parsing, throwing parse exceptions once the application attempts to obtain multipart files or parameters.- 从以下版本开始:
- 3.2.9
isMultipart
public boolean isMultipart(HttpServletRequest request)
从接口复制的说明:MultipartResolver
Determine if the given request contains multipart content.Will typically check for content type "multipart/form-data", but the actually accepted requests might depend on the capabilities of the resolver implementation.
- 指定者:
isMultipart
在接口中MultipartResolver
- 参数:
request
- the servlet request to be evaluated- 返回:
- whether the request contains multipart content
resolveMultipart
public MultipartHttpServletRequest resolveMultipart(HttpServletRequest request) throws MultipartException
从接口复制的说明:MultipartResolver
Parse the given HTTP request into multipart files and parameters, and wrap the request inside aMultipartHttpServletRequest
object that provides access to file descriptors and makes contained parameters accessible via the standard ServletRequest methods.- 指定者:
resolveMultipart
在接口中MultipartResolver
- 参数:
request
- the servlet request to wrap (must be of a multipart content type)- 返回:
- the wrapped servlet request
- 抛出:
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()
cleanupMultipart
public void cleanupMultipart(MultipartHttpServletRequest request)
从接口复制的说明:MultipartResolver
Cleanup any resources used for the multipart handling, like a storage for the uploaded files.- 指定者:
cleanupMultipart
在接口中MultipartResolver
- 参数:
request
- the request to cleanup resources for