java.lang.Object | |
↳ | org.springframework.web.multipart.commons.CommonsFileUploadSupport |
Known Direct Subclasses |
Base class for multipart resolvers that use Jakarta Commons FileUpload 1.2 or above.
Provides common configuration properties and parsing functionality for multipart requests, using a Map of Spring CommonsMultipartFile instances as representation of uploaded files and a String-based parameter Map as representation of uploaded form fields.
Subclasses implement concrete resolution strategies for Servlet or Portlet environments: see CommonsMultipartResolver and CommonsPortletMultipartResolver, respectively. This base class is not tied to either of those APIs, factoring out common functionality.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
CommonsFileUploadSupport.MultipartParsingResult | Holder for a Map of Spring MultipartFiles and a Map of multipart parameters. |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
logger |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Instantiate a new CommonsFileUploadSupport with its
corresponding FileItemFactory and FileUpload instances.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Return the underlying
org.apache.commons.fileupload.disk.DiskFileItemFactory
instance. | |||||||||||
Return the underlying
org.apache.commons.fileupload.FileUpload
instance. | |||||||||||
Set the default character encoding to use for parsing requests,
to be applied to headers of individual parts and to form fields.
| |||||||||||
Set the maximum allowed size (in bytes) before uploads are written to disk.
| |||||||||||
Set the maximum allowed size (in bytes) before uploads are refused.
| |||||||||||
Set the temporary directory where uploaded files get stored.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Cleanup the Spring MultipartFiles created during multipart parsing,
potentially holding temporary data on disk.
| |||||||||||
Factory method for a Commons DiskFileItemFactory instance.
| |||||||||||
Factory method for a Commons FileUpload instance.
| |||||||||||
Parse the given List of Commons FileItems into a Spring MultipartParsingResult,
containing Spring MultipartFile instances and a Map of multipart parameter.
| |||||||||||
Determine an appropriate FileUpload instance for the given encoding.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Instantiate a new CommonsFileUploadSupport with its corresponding FileItemFactory and FileUpload instances.
Return the underlying org.apache.commons.fileupload.disk.DiskFileItemFactory
instance. There is hardly any need to access this.
Return the underlying org.apache.commons.fileupload.FileUpload
instance. There is hardly any need to access this.
Set the default character encoding to use for parsing requests, to be applied to headers of individual parts and to form fields. Default is ISO-8859-1, according to the Servlet spec.
If the request specifies a character encoding itself, the request
encoding will override this setting. This also allows for generically
overriding the character encoding in a filter that invokes the
ServletRequest.setCharacterEncoding
method.
defaultEncoding | the character encoding to use |
---|
getCharacterEncoding()
setCharacterEncoding(String)
DEFAULT_CHARACTER_ENCODING
Set the maximum allowed size (in bytes) before uploads are written to disk. Uploaded files will still be received past this amount, but they will not be stored in memory. Default is 10240, according to Commons FileUpload.
maxInMemorySize | the maximum in memory size allowed |
---|
Set the maximum allowed size (in bytes) before uploads are refused. -1 indicates no limit (the default).
maxUploadSize | the maximum upload size allowed |
---|
Set the temporary directory where uploaded files get stored. Default is the servlet container's temporary directory for the web application.
IOException |
---|
Cleanup the Spring MultipartFiles created during multipart parsing, potentially holding temporary data on disk.
Deletes the underlying Commons FileItem instances.
multipartFiles | Collection of MultipartFile instances |
---|
Factory method for a Commons DiskFileItemFactory instance.
Default implementation returns a standard DiskFileItemFactory. Can be overridden to use a custom subclass, e.g. for testing purposes.
Factory method for a Commons FileUpload instance.
To be implemented by subclasses.
fileItemFactory | the Commons FileItemFactory to build upon |
---|
Parse the given List of Commons FileItems into a Spring MultipartParsingResult, containing Spring MultipartFile instances and a Map of multipart parameter.
fileItems | the Commons FileIterms to parse |
---|---|
encoding | the encoding to use for form fields |
Determine an appropriate FileUpload instance for the given encoding.
Default implementation returns the shared FileUpload instance if the encoding matches, else creates a new FileUpload instance with the same configuration other than the desired encoding.
encoding | the character encoding to use |
---|