Package org.alfresco.repo.jscript
Class ScriptNode.ScriptContentData
java.lang.Object
org.alfresco.repo.jscript.ScriptNode.ScriptContentData
- All Implemented Interfaces:
Serializable,org.springframework.extensions.surf.util.Content
- Enclosing class:
- ScriptNode
public class ScriptNode.ScriptContentData
extends Object
implements org.springframework.extensions.surf.util.Content, Serializable
Inner class wrapping and providing access to a ContentData property
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddelete()Delete the content streamlonggetSize()getUrl()voidGuess the character encoding of a file.voidguessMimetype(String filename) Guess the mimetype for the given filename - uses the extension to match on system mimetype mapbooleanisDirty()voidsetContent(String content) Set the content streamvoidsetEncoding(String encoding) voidsetMimetype(String mimetype) voidwrite(InputStream inputStream) Set the content stream from another input stream.voidwrite(org.springframework.extensions.surf.util.Content content) Set the content stream from another content object.voidwrite(org.springframework.extensions.surf.util.Content content, boolean applyMimetype, boolean guessEncoding) Deprecated.voidwrite(org.springframework.extensions.surf.util.Content content, boolean applyMimetype, boolean guessEncoding, String fileName) Set the content stream from another content object.
-
Constructor Details
-
ScriptContentData
Constructor- Parameters:
contentData- The ContentData object this object wrapsproperty- The property the ContentData is attached too
-
-
Method Details
-
getContent
- Specified by:
getContentin interfaceorg.springframework.extensions.surf.util.Content
-
getInputStream
- Specified by:
getInputStreamin interfaceorg.springframework.extensions.surf.util.Content
-
getReader
- Specified by:
getReaderin interfaceorg.springframework.extensions.surf.util.Content
-
isDirty
public boolean isDirty()- Returns:
trueif the contentData has a binary (content URL) associated and the updates on contentData and related properties should be saved.falseif the contentData has a temporary value and no actual binary to be persisted.
-
setContent
Set the content stream- Parameters:
content- Content string to set
-
write
public void write(org.springframework.extensions.surf.util.Content content) Set the content stream from another content object.- Parameters:
content- ScriptContent to set
-
write
@Deprecated public void write(org.springframework.extensions.surf.util.Content content, boolean applyMimetype, boolean guessEncoding) Deprecated.Set the content stream from another content object.- Parameters:
content- ScriptContent to setapplyMimetype- If true, apply the mimetype from the Content object, else leave the original mimetypeguessEncoding- If true, guess the encoding from the underlying input stream, else use encoding set in the Content object as supplied.
-
write
public void write(org.springframework.extensions.surf.util.Content content, boolean applyMimetype, boolean guessEncoding, String fileName) Set the content stream from another content object.- Parameters:
content- ScriptContent to setapplyMimetype- If true, apply the mimetype from the Content object, else leave the original mimetypeguessEncoding- If true, guess the encoding from the underlying input stream, else use encoding set in the Content object as supplied.fileName- The filename for the attachment.
-
write
Set the content stream from another input stream.- Parameters:
inputStream- InputStream
-
delete
public void delete()Delete the content stream -
getUrl
- Returns:
- download URL to the content
-
getDownloadUrl
- Returns:
- download URL to the content for a document item only
-
getSize
public long getSize()- Specified by:
getSizein interfaceorg.springframework.extensions.surf.util.Content
-
getMimetype
- Specified by:
getMimetypein interfaceorg.springframework.extensions.surf.util.Content
-
getEncoding
- Specified by:
getEncodingin interfaceorg.springframework.extensions.surf.util.Content
-
setEncoding
-
setMimetype
-
guessMimetype
Guess the mimetype for the given filename - uses the extension to match on system mimetype map -
guessEncoding
public void guessEncoding()Guess the character encoding of a file. For non-text files UTF-8 default is applied, otherwise the appropriate encoding (such as UTF-16 or similar) will be appiled if detected.
-