|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2016 the original author or authors. |
|
|
|
* Copyright 2002-2017 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -27,7 +27,7 @@ import org.springframework.core.io.InputStreamSource; |
|
|
|
* |
|
|
|
* |
|
|
|
* <p>The file contents are either stored in memory or temporarily on disk. |
|
|
|
* <p>The file contents are either stored in memory or temporarily on disk. |
|
|
|
* In either case, the user is responsible for copying file contents to a |
|
|
|
* In either case, the user is responsible for copying file contents to a |
|
|
|
* session-level or persistent store as and if desired. The temporary storages |
|
|
|
* session-level or persistent store as and if desired. The temporary storage |
|
|
|
* will be cleared at the end of request processing. |
|
|
|
* will be cleared at the end of request processing. |
|
|
|
* |
|
|
|
* |
|
|
|
* @author Juergen Hoeller |
|
|
|
* @author Juergen Hoeller |
|
|
|
@ -50,6 +50,8 @@ public interface MultipartFile extends InputStreamSource { |
|
|
|
* but it typically will not with any other than Opera. |
|
|
|
* but it typically will not with any other than Opera. |
|
|
|
* @return the original filename, or the empty String if no file has been chosen |
|
|
|
* @return the original filename, or the empty String if no file has been chosen |
|
|
|
* in the multipart form, or {@code null} if not defined or not available |
|
|
|
* in the multipart form, or {@code null} if not defined or not available |
|
|
|
|
|
|
|
* @see org.apache.commons.fileupload.FileItem#getName() |
|
|
|
|
|
|
|
* @see org.springframework.web.multipart.commons.CommonsMultipartFile#setPreserveFilename |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
String getOriginalFilename(); |
|
|
|
String getOriginalFilename(); |
|
|
|
|
|
|
|
|
|
|
|
@ -81,7 +83,7 @@ public interface MultipartFile extends InputStreamSource { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Return an InputStream to read the contents of the file from. |
|
|
|
* Return an InputStream to read the contents of the file from. |
|
|
|
* The user is responsible for closing the stream. |
|
|
|
* <p>The user is responsible for closing the returned stream. |
|
|
|
* @return the contents of the file as stream, or an empty stream if empty |
|
|
|
* @return the contents of the file as stream, or an empty stream if empty |
|
|
|
* @throws IOException in case of access errors (if the temporary store fails) |
|
|
|
* @throws IOException in case of access errors (if the temporary store fails) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@ -91,18 +93,22 @@ public interface MultipartFile extends InputStreamSource { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Transfer the received file to the given destination file. |
|
|
|
* Transfer the received file to the given destination file. |
|
|
|
* <p>This may either move the file in the filesystem, copy the file in the |
|
|
|
* <p>This may either move the file in the filesystem, copy the file in the |
|
|
|
* filesystem, or save memory-held contents to the destination file. |
|
|
|
* filesystem, or save memory-held contents to the destination file. If the |
|
|
|
* If the destination file already exists, it will be deleted first. |
|
|
|
* destination file already exists, it will be deleted first. |
|
|
|
* <p>If the file has been moved in the filesystem, this operation cannot |
|
|
|
* <p>If the target file has been moved in the filesystem, this operation |
|
|
|
* be invoked again. Therefore, call this method just once to be able to |
|
|
|
* cannot be invoked again afterwards. Therefore, call this method just once |
|
|
|
* work with any storage mechanism. |
|
|
|
* in order to work with any storage mechanism. |
|
|
|
* <p><strong>Note:</strong> when using Servlet 3.0 multipart support you |
|
|
|
* <p><b>NOTE:</b> Depending on the underlying provider, temporary storage |
|
|
|
* need to configure the location relative to which files will be copied |
|
|
|
* may be container-dependent, including the base directory for relative |
|
|
|
* as explained in {@link javax.servlet.http.Part#write}. |
|
|
|
* destinations specified here (e.g. with Servlet 3.0 multipart handling). |
|
|
|
* @param dest the destination file |
|
|
|
* For absolute destinations, the target file may get renamed/moved from its |
|
|
|
|
|
|
|
* temporary location or newly copied, even if a temporary copy already exists. |
|
|
|
|
|
|
|
* @param dest the destination file (typically absolute) |
|
|
|
* @throws IOException in case of reading or writing errors |
|
|
|
* @throws IOException in case of reading or writing errors |
|
|
|
* @throws IllegalStateException if the file has already been moved |
|
|
|
* @throws IllegalStateException if the file has already been moved |
|
|
|
* in the filesystem and is not available anymore for another transfer |
|
|
|
* in the filesystem and is not available anymore for another transfer |
|
|
|
|
|
|
|
* @see org.apache.commons.fileupload.FileItem#write(File) |
|
|
|
|
|
|
|
* @see javax.servlet.http.Part#write(String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
void transferTo(File dest) throws IOException, IllegalStateException; |
|
|
|
void transferTo(File dest) throws IOException, IllegalStateException; |
|
|
|
|
|
|
|
|
|
|
|
|