org.springframework.web.multipart
Interface MultipartResolver

All Known Implementing Classes:
CommonsMultipartResolver, CosMultipartResolver

public interface MultipartResolver

Interface for multipart resolution strategies that handle file uploads as defined in RFC 1867. Implementations are typically usable both within any application context and standalone.

There are two concrete implementations included in Spring:

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 DispatcherServlet. Use RequestContextUtils.getMultipartResolver() to retrieve the current resolver in controllers etc, independent of the actual resolution strategy.

Since:
29.9.2003
Author:
Juergen Hoeller, Trevor D. Cook
See Also:
MultipartHttpServletRequest, MultipartFile, CommonsMultipartResolver, CosMultipartResolver, DispatcherServlet, RequestContextUtils.getMultipartResolver(javax.servlet.http.HttpServletRequest)

Method Summary
 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 request contains multipart content.
 MultipartHttpServletRequest resolveMultipart(javax.servlet.http.HttpServletRequest request)
          Wrap the servlet request inside a MultipartHttpServletRequest.
 

Method Detail

isMultipart

public boolean isMultipart(javax.servlet.http.HttpServletRequest request)
Determine if the 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.

Parameters:
request - the servlet request to be evaluated
Returns:
true if the request contains multipart content; false otherwise

resolveMultipart

public MultipartHttpServletRequest resolveMultipart(javax.servlet.http.HttpServletRequest request)
                                             throws MultipartException
Wrap the servlet request inside a MultipartHttpServletRequest.

Parameters:
request - the servlet request to wrap (must be of a multipart content type)
Returns:
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)

cleanupMultipart

public void cleanupMultipart(MultipartHttpServletRequest request)
Cleanup any resources used for the multipart handling, like a storage for the uploaded files.

Parameters:
request - the request to cleanup resources for


Copyright (C) 2003-2004 The Spring Framework Project.