标签:throw 提取 style contain use handler containe bool whether
1、MultipartResolver
MultipartResolver接口提供了spring mvc的上传视图,MultipartResolver实例在请求转交给handlermapping之前。 也就是说DispatcherServlet ,在请求映射的时候,若找到MultipartResolver这个实例的话,
就直接把请求转交给MultipartResolver
/** * Determine if the given request contains multipart content. * <p>Will typically check for content type "multipart/form-data", but the actually * accepted requests might depend on the capabilities of the resolver implementation. * @param request the servlet request to be evaluated * @return whether the request contains multipart content */ boolean isMultipart(HttpServletRequest request); /** * Parse the given HTTP request into multipart files and parameters, * and wrap the request inside a * {@link org.springframework.web.multipart.MultipartHttpServletRequest} * object that provides access to file descriptors and makes contained * parameters accessible via the standard ServletRequest methods. * @param request the servlet request to wrap (must be of a multipart content type) * @return the wrapped servlet request * @throws MultipartException if the servlet request is not multipart, or if * implementation-specific problems are encountered (such as exceeding file size limits) * @see MultipartHttpServletRequest#getFile * @see MultipartHttpServletRequest#getFileNames * @see MultipartHttpServletRequest#getFileMap * @see javax.servlet.http.HttpServletRequest#getParameter * @see javax.servlet.http.HttpServletRequest#getParameterNames * @see javax.servlet.http.HttpServletRequest#getParameterMap */ MultipartHttpServletRequest resolveMultipart(HttpServletRequest request) throws MultipartException; /** * Cleanup any resources used for the multipart handling, * like a storage for the uploaded files. * @param request the request to cleanup resources for */ void cleanupMultipart(MultipartHttpServletRequest request);
MultipartResolver接口提供了3个方法:
boolean isMultipart(HttpServletRequest request): 检查当前请求是否是multipart content type
resolveMultipart: 将httprequest转换成MultipartHttpServletRequest
已知的子类: CommonsMultipartResolver, StandardServletMultipartResolver
2、multipartRequest
multipartRequest接口可以讲request对象封装成multipartRequest,提取请求的信息,MultipartReques类主要是对文件上传进行的处理。
标签:throw 提取 style contain use handler containe bool whether
原文地址:http://www.cnblogs.com/kimobolo/p/7110575.html