Class CommonsMultipartFile
java.lang.Object
org.springframework.web.multipart.commons.CommonsMultipartFile
- All Implemented Interfaces:
Serializable,org.springframework.core.io.InputStreamSource,org.springframework.web.multipart.MultipartFile
public class CommonsMultipartFile
extends Object
implements org.springframework.web.multipart.MultipartFile, Serializable
MultipartFile implementation for Apache Commons FileUpload.- Since:
- 29.09.2003
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCommonsMultipartFile(org.apache.tomcat.util.http.fileupload.FileItem fileItem) Create an instance wrapping the given FileItem. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]getBytes()final org.apache.tomcat.util.http.fileupload.FileItemReturn the underlyingorg.apache.commons.fileupload.FileIteminstance.getName()longgetSize()Return a description for the storage location of the multipart content.protected booleanDetermine whether the multipart content is still available.booleanisEmpty()voidsetPreserveFilename(boolean preserveFilename) Set whether to preserve the filename as sent by the client, not stripping off path information ingetOriginalFilename().toString()voidtransferTo(File dest) voidtransferTo(Path dest) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.web.multipart.MultipartFile
getResource
-
Field Details
-
logger
protected static final org.apache.commons.logging.Log logger
-
-
Constructor Details
-
CommonsMultipartFile
public CommonsMultipartFile(org.apache.tomcat.util.http.fileupload.FileItem fileItem) Create an instance wrapping the given FileItem.- Parameters:
fileItem- the FileItem to wrap
-
-
Method Details
-
getFileItem
public final org.apache.tomcat.util.http.fileupload.FileItem getFileItem()Return the underlyingorg.apache.commons.fileupload.FileIteminstance. There is hardly any need to access this. -
setPreserveFilename
public void setPreserveFilename(boolean preserveFilename) Set whether to preserve the filename as sent by the client, not stripping off path information ingetOriginalFilename().Default is "false", stripping off path information that may prefix the actual filename e.g. from Opera. Switch this to "true" for preserving the client-specified filename as-is, including potential path separators.
- Since:
- 4.3.5
- See Also:
-
getName
- Specified by:
getNamein interfaceorg.springframework.web.multipart.MultipartFile
-
getOriginalFilename
- Specified by:
getOriginalFilenamein interfaceorg.springframework.web.multipart.MultipartFile
-
getContentType
- Specified by:
getContentTypein interfaceorg.springframework.web.multipart.MultipartFile
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceorg.springframework.web.multipart.MultipartFile
-
getSize
public long getSize()- Specified by:
getSizein interfaceorg.springframework.web.multipart.MultipartFile
-
getBytes
public byte[] getBytes()- Specified by:
getBytesin interfaceorg.springframework.web.multipart.MultipartFile
-
getInputStream
- Specified by:
getInputStreamin interfaceorg.springframework.core.io.InputStreamSource- Specified by:
getInputStreamin interfaceorg.springframework.web.multipart.MultipartFile- Throws:
IOException
-
transferTo
- Specified by:
transferToin interfaceorg.springframework.web.multipart.MultipartFile- Throws:
IOExceptionIllegalStateException
-
transferTo
- Specified by:
transferToin interfaceorg.springframework.web.multipart.MultipartFile- Throws:
IOExceptionIllegalStateException
-
isAvailable
protected boolean isAvailable()Determine whether the multipart content is still available. If a temporary file has been moved, the content is no longer available. -
getStorageDescription
Return a description for the storage location of the multipart content. Tries to be as specific as possible: mentions the file location in case of a temporary file. -
toString
-