Package com.atlassian.confluence.core
Class UploadedResource
- java.lang.Object
 - 
- com.atlassian.confluence.core.UploadedResource
 
 
- 
- All Implemented Interfaces:
 AttachmentResource,org.springframework.core.io.InputStreamSource,org.springframework.core.io.Resource
public class UploadedResource extends Object implements AttachmentResource
Resource wrapper for uploaded files. This will become extra handy once we get a better multipart file handling e.g. Attachments handled entirely in memory 
- 
- 
Constructor Summary
Constructors Constructor Description UploadedResource(com.atlassian.xwork.FileUploadUtils.UploadedFile uploadedFile)UploadedResource(com.atlassian.xwork.FileUploadUtils.UploadedFile uploadedFile, String comment)UploadedResource(com.atlassian.xwork.FileUploadUtils.UploadedFile uploadedFile, String comment, boolean minorEdit)UploadedResource(File file, String filename, String contentType, String comment)UploadedResource(File file, String filename, String contentType, String comment, boolean minorEdit, boolean hidden)Creates an upload resource. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longcontentLength()org.springframework.core.io.ResourcecreateRelative(String relativePath)booleanexists()StringgetComment()longgetContentLength()StringgetContentType()StringgetDescription()FilegetFile()StringgetFilename()InputStreamgetInputStream()URIgetURI()URLgetURL()booleanisHidden()booleanisMinorEdit()booleanisOpen()booleanisReadable()longlastModified()StringtoString() 
 - 
 
- 
- 
Constructor Detail
- 
UploadedResource
public UploadedResource(com.atlassian.xwork.FileUploadUtils.UploadedFile uploadedFile)
 
- 
UploadedResource
public UploadedResource(com.atlassian.xwork.FileUploadUtils.UploadedFile uploadedFile, String comment) 
- 
UploadedResource
public UploadedResource(File file, String filename, String contentType, String comment)
 
- 
UploadedResource
public UploadedResource(com.atlassian.xwork.FileUploadUtils.UploadedFile uploadedFile, String comment, boolean minorEdit) 
- 
UploadedResource
public UploadedResource(File file, String filename, String contentType, String comment, boolean minorEdit, boolean hidden)
Creates an upload resource.- Parameters:
 file- the file to be uploaded, cannot be nullcomment- a comment for the upload. Can be nullminorEdit- boolean indicating whether this upload is a minor edit or not. Minor edit set to true means that this upload should not generate any notifications, but it will be added to the activity stream.hidden- boolean indicating whether we want this upload to be hidden or not. Hidden set to true means that this upload should not generate any notifications, or be added to the activity stream.
 
 - 
 
- 
Method Detail
- 
getDescription
public String getDescription()
- Specified by:
 getDescriptionin interfaceorg.springframework.core.io.Resource
 
- 
getFile
public File getFile()
- Specified by:
 getFilein interfaceorg.springframework.core.io.Resource
 
- 
getFilename
public String getFilename() throws IllegalStateException
- Specified by:
 getFilenamein interfaceorg.springframework.core.io.Resource- Throws:
 IllegalStateException
 
- 
getComment
public String getComment()
- Specified by:
 getCommentin interfaceAttachmentResource- Returns:
 - the comment associated with the attachment or null if there is no comment
 
 
- 
getInputStream
public InputStream getInputStream() throws IOException
- Specified by:
 getInputStreamin interfaceorg.springframework.core.io.InputStreamSource- Throws:
 IOException
 
- 
getContentType
public String getContentType()
- Specified by:
 getContentTypein interfaceAttachmentResource- Returns:
 - the content/mime type of the attachment
 
 
- 
getContentLength
public long getContentLength()
- Specified by:
 getContentLengthin interfaceAttachmentResource- Returns:
 - the content length (size of the attachment)
 
 
- 
contentLength
public long contentLength()
- Specified by:
 contentLengthin interfaceorg.springframework.core.io.Resource
 
- 
isMinorEdit
public boolean isMinorEdit()
- Specified by:
 isMinorEditin interfaceAttachmentResource- Returns:
 - true if the attachment is a minor edit (see 
Attachment.isMinorEdit()) 
 
- 
isHidden
public boolean isHidden()
- Specified by:
 isHiddenin interfaceAttachmentResource- Returns:
 - true if the attachment is hidden (see 
Attachment.isHidden()) 
 
- 
exists
public boolean exists()
- Specified by:
 existsin interfaceorg.springframework.core.io.Resource
 
- 
isOpen
public boolean isOpen()
- Specified by:
 isOpenin interfaceorg.springframework.core.io.Resource
 
- 
getURL
public URL getURL() throws IOException
- Specified by:
 getURLin interfaceorg.springframework.core.io.Resource- Throws:
 IOException
 
- 
createRelative
public org.springframework.core.io.Resource createRelative(String relativePath) throws IOException
- Specified by:
 createRelativein interfaceorg.springframework.core.io.Resource- Throws:
 IOException
 
- 
isReadable
public boolean isReadable()
- Specified by:
 isReadablein interfaceorg.springframework.core.io.Resource
 
- 
getURI
public URI getURI() throws IOException
- Specified by:
 getURIin interfaceorg.springframework.core.io.Resource- Throws:
 IOException
 
- 
lastModified
public long lastModified() throws IOException- Specified by:
 lastModifiedin interfaceorg.springframework.core.io.Resource- Throws:
 IOException
 
 - 
 
 -