|
|
@ -23,10 +23,10 @@ import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.fileupload.FileItem; |
|
|
|
import com.fr.third.org.apache.commons.fileupload.FileItem; |
|
|
|
import org.apache.commons.fileupload.FileItemFactory; |
|
|
|
import com.fr.third.org.apache.commons.fileupload.FileItemFactory; |
|
|
|
import org.apache.commons.fileupload.FileUpload; |
|
|
|
import com.fr.third.org.apache.commons.fileupload.FileUpload; |
|
|
|
import org.apache.commons.fileupload.disk.DiskFileItemFactory; |
|
|
|
import com.fr.third.org.apache.commons.fileupload.disk.DiskFileItemFactory; |
|
|
|
import org.apache.commons.logging.Log; |
|
|
|
import org.apache.commons.logging.Log; |
|
|
|
import org.apache.commons.logging.LogFactory; |
|
|
|
import org.apache.commons.logging.LogFactory; |
|
|
|
|
|
|
|
|
|
|
@ -84,7 +84,7 @@ public abstract class CommonsFileUploadSupport { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Return the underlying {@code org.apache.commons.fileupload.disk.DiskFileItemFactory} |
|
|
|
* Return the underlying {@code com.fr.third.org.apache.commons.fileupload.disk.DiskFileItemFactory} |
|
|
|
* instance. There is hardly any need to access this. |
|
|
|
* instance. There is hardly any need to access this. |
|
|
|
* @return the underlying DiskFileItemFactory instance |
|
|
|
* @return the underlying DiskFileItemFactory instance |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -93,7 +93,7 @@ public abstract class CommonsFileUploadSupport { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Return the underlying {@code org.apache.commons.fileupload.FileUpload} |
|
|
|
* Return the underlying {@code com.fr.third.org.apache.commons.fileupload.FileUpload} |
|
|
|
* instance. There is hardly any need to access this. |
|
|
|
* instance. There is hardly any need to access this. |
|
|
|
* @return the underlying FileUpload instance |
|
|
|
* @return the underlying FileUpload instance |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -105,7 +105,7 @@ public abstract class CommonsFileUploadSupport { |
|
|
|
* Set the maximum allowed size (in bytes) before an upload gets rejected. |
|
|
|
* Set the maximum allowed size (in bytes) before an upload gets rejected. |
|
|
|
* -1 indicates no limit (the default). |
|
|
|
* -1 indicates no limit (the default). |
|
|
|
* @param maxUploadSize the maximum upload size allowed |
|
|
|
* @param maxUploadSize the maximum upload size allowed |
|
|
|
* @see org.apache.commons.fileupload.FileUploadBase#setSizeMax |
|
|
|
* @see com.fr.third.org.apache.commons.fileupload.FileUploadBase#setSizeMax |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void setMaxUploadSize(long maxUploadSize) { |
|
|
|
public void setMaxUploadSize(long maxUploadSize) { |
|
|
|
this.fileUpload.setSizeMax(maxUploadSize); |
|
|
|
this.fileUpload.setSizeMax(maxUploadSize); |
|
|
@ -116,7 +116,7 @@ public abstract class CommonsFileUploadSupport { |
|
|
|
* an upload gets rejected. -1 indicates no limit (the default). |
|
|
|
* an upload gets rejected. -1 indicates no limit (the default). |
|
|
|
* @param maxUploadSizePerFile the maximum upload size per file |
|
|
|
* @param maxUploadSizePerFile the maximum upload size per file |
|
|
|
* @since 4.2 |
|
|
|
* @since 4.2 |
|
|
|
* @see org.apache.commons.fileupload.FileUploadBase#setFileSizeMax |
|
|
|
* @see com.fr.third.org.apache.commons.fileupload.FileUploadBase#setFileSizeMax |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void setMaxUploadSizePerFile(long maxUploadSizePerFile) { |
|
|
|
public void setMaxUploadSizePerFile(long maxUploadSizePerFile) { |
|
|
|
this.fileUpload.setFileSizeMax(maxUploadSizePerFile); |
|
|
|
this.fileUpload.setFileSizeMax(maxUploadSizePerFile); |
|
|
@ -127,7 +127,7 @@ public abstract class CommonsFileUploadSupport { |
|
|
|
* Uploaded files will still be received past this amount, but they will not be |
|
|
|
* Uploaded files will still be received past this amount, but they will not be |
|
|
|
* stored in memory. Default is 10240, according to Commons FileUpload. |
|
|
|
* stored in memory. Default is 10240, according to Commons FileUpload. |
|
|
|
* @param maxInMemorySize the maximum in memory size allowed |
|
|
|
* @param maxInMemorySize the maximum in memory size allowed |
|
|
|
* @see org.apache.commons.fileupload.disk.DiskFileItemFactory#setSizeThreshold |
|
|
|
* @see com.fr.third.org.apache.commons.fileupload.disk.DiskFileItemFactory#setSizeThreshold |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void setMaxInMemorySize(int maxInMemorySize) { |
|
|
|
public void setMaxInMemorySize(int maxInMemorySize) { |
|
|
|
this.fileItemFactory.setSizeThreshold(maxInMemorySize); |
|
|
|
this.fileItemFactory.setSizeThreshold(maxInMemorySize); |
|
|
@ -145,7 +145,7 @@ public abstract class CommonsFileUploadSupport { |
|
|
|
* @see javax.servlet.ServletRequest#getCharacterEncoding |
|
|
|
* @see javax.servlet.ServletRequest#getCharacterEncoding |
|
|
|
* @see javax.servlet.ServletRequest#setCharacterEncoding |
|
|
|
* @see javax.servlet.ServletRequest#setCharacterEncoding |
|
|
|
* @see WebUtils#DEFAULT_CHARACTER_ENCODING |
|
|
|
* @see WebUtils#DEFAULT_CHARACTER_ENCODING |
|
|
|
* @see org.apache.commons.fileupload.FileUploadBase#setHeaderEncoding |
|
|
|
* @see com.fr.third.org.apache.commons.fileupload.FileUploadBase#setHeaderEncoding |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void setDefaultEncoding(String defaultEncoding) { |
|
|
|
public void setDefaultEncoding(String defaultEncoding) { |
|
|
|
this.fileUpload.setHeaderEncoding(defaultEncoding); |
|
|
|
this.fileUpload.setHeaderEncoding(defaultEncoding); |
|
|
@ -248,7 +248,7 @@ public abstract class CommonsFileUploadSupport { |
|
|
|
* @param fileItems the Commons FileIterms to parse |
|
|
|
* @param fileItems the Commons FileIterms to parse |
|
|
|
* @param encoding the encoding to use for form fields |
|
|
|
* @param encoding the encoding to use for form fields |
|
|
|
* @return the Spring MultipartParsingResult |
|
|
|
* @return the Spring MultipartParsingResult |
|
|
|
* @see CommonsMultipartFile#CommonsMultipartFile(org.apache.commons.fileupload.FileItem) |
|
|
|
* @see CommonsMultipartFile#CommonsMultipartFile(com.fr.third.org.apache.commons.fileupload.FileItem) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected MultipartParsingResult parseFileItems(List<FileItem> fileItems, String encoding) { |
|
|
|
protected MultipartParsingResult parseFileItems(List<FileItem> fileItems, String encoding) { |
|
|
|
MultiValueMap<String, MultipartFile> multipartFiles = new LinkedMultiValueMap<String, MultipartFile>(); |
|
|
|
MultiValueMap<String, MultipartFile> multipartFiles = new LinkedMultiValueMap<String, MultipartFile>(); |
|
|
@ -320,7 +320,7 @@ public abstract class CommonsFileUploadSupport { |
|
|
|
* potentially holding temporary data on disk. |
|
|
|
* potentially holding temporary data on disk. |
|
|
|
* <p>Deletes the underlying Commons FileItem instances. |
|
|
|
* <p>Deletes the underlying Commons FileItem instances. |
|
|
|
* @param multipartFiles Collection of MultipartFile instances |
|
|
|
* @param multipartFiles Collection of MultipartFile instances |
|
|
|
* @see org.apache.commons.fileupload.FileItem#delete() |
|
|
|
* @see com.fr.third.org.apache.commons.fileupload.FileItem#delete() |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected void cleanupFileItems(MultiValueMap<String, MultipartFile> multipartFiles) { |
|
|
|
protected void cleanupFileItems(MultiValueMap<String, MultipartFile> multipartFiles) { |
|
|
|
for (List<MultipartFile> files : multipartFiles.values()) { |
|
|
|
for (List<MultipartFile> files : multipartFiles.values()) { |
|
|
|