Class TemplateDoc
java.lang.Object
ch.software_atelier.simpleflex.docs.WebDoc
ch.software_atelier.simpleflex.docs.impl.TemplateDoc
- All Implemented Interfaces:
Closeable,AutoCloseable
- Author:
- tk
-
Nested Class Summary
Nested classes/interfaces inherited from class ch.software_atelier.simpleflex.docs.WebDoc
WebDoc.HTTPCode -
Field Summary
Fields inherited from class ch.software_atelier.simpleflex.docs.WebDoc
DATA_BYTE, DATA_STREAM -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a placeholder and a refering value.byte[]byteData()If you want to return the documents data as a byte[], you have to do that here.voidclear()voidclose()dataType()Specifies the Type of served data.mime()This method has to return the MIME-Type of the Document.name()This method has to return the FileName of the Document.voidreplace()Calculates the document.longsize()This method has to return the size of the Document in bytes.If you want to return the documents data as a Stream, you have to do that here.Methods inherited from class ch.software_atelier.simpleflex.docs.WebDoc
getHeaders, getHttpCode, setHTTPCode
-
Constructor Details
-
TemplateDoc
- Throws:
IOException
-
TemplateDoc
- Throws:
IOException
-
-
Method Details
-
add
Adds a placeholder and a refering value. Call the method replace() to replace all placeholders by the refering values.- Parameters:
placeholder-value-
-
replace
public void replace()Calculates the document. It replaces all placeholders by the values. -
clear
public void clear() -
size
public long size()Description copied from class:WebDocThis method has to return the size of the Document in bytes. -
mime
Description copied from class:WebDocThis method has to return the MIME-Type of the Document. Example: text/plain. You can also use the static Method Utils.getMime(String ext) to get the MIME-Type of a File-Extension. -
name
Description copied from class:WebDocThis method has to return the FileName of the Document. -
byteData
public byte[] byteData()Description copied from class:WebDocIf you want to return the documents data as a byte[], you have to do that here. Be sure, that the method dataType() returns WebDoc.DATA_BYTE! Else just return null or something else. If the method dataType() does not return WebDoc.DATA_BYTE, this method will never be called. -
streamData
Description copied from class:WebDocIf you want to return the documents data as a Stream, you have to do that here. Be sure, that the method dataType() returns WebDoc.DATA_STREAM! Else just return null or something else. If the method dataType() does not return WebDoc.DATA_STREAM, this method will never be called. The Stream will be closed by the Server-App so you have nothing to do with that.- Specified by:
streamDatain classWebDoc- Returns:
-
dataType
Description copied from class:WebDocSpecifies the Type of served data. Look at streamData() and/or byteData() -
close
public void close()
-