Package freemarker.core
Class PlainTextOutputFormat
- java.lang.Object
-
- freemarker.core.OutputFormat
-
- freemarker.core.PlainTextOutputFormat
-
public final class PlainTextOutputFormat extends OutputFormat
Represents the plain text output format (MIME type "text/plain", name "plainText"). This format doesn't support escaping. This format doesn't allow mixing in template output values of other output formats.The main difference from
UndefinedOutputFormatis that this format doesn't allow inserting values of another output format into itself (unless they can be converted to plain text), whileUndefinedOutputFormatwould just insert the foreign "markup" as is. Also, this format has {"text/plain"} MIME type, whileUndefinedOutputFormathasnull.- Since:
- 2.3.24
-
-
Field Summary
Fields Modifier and Type Field Description static PlainTextOutputFormatINSTANCE
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetMimeType()Returns the MIME type of the output format.java.lang.StringgetName()The short name used to refer to this format (like in the#ftlheader).booleanisOutputFormatMixingAllowed()Tells if this output format allows insertingTemplateMarkupOutputModel-s of another output formats into it.-
Methods inherited from class freemarker.core.OutputFormat
toString, toStringExtraProperties
-
-
-
-
Field Detail
-
INSTANCE
public static final PlainTextOutputFormat INSTANCE
-
-
Method Detail
-
isOutputFormatMixingAllowed
public boolean isOutputFormatMixingAllowed()
Description copied from class:OutputFormatTells if this output format allows insertingTemplateMarkupOutputModel-s of another output formats into it. Iftrue, the foreignTemplateMarkupOutputModelwill be inserted into the output as is (like if the surrounding output format was the same). This is usually a bad idea to allow, as such an event could indicate application bugs. If this method returnsfalse(recommended), then FreeMarker will try to assimilate the inserted value by converting its format to this format, which will currently (2.3.24) cause exception, unless the inserted value is made by escaping plain text and the target format is non-escaping, in which case format conversion is trivially possible. (It's not impossible that conversions will be extended beyond this, if there will be demand for that.)truevalue is used byUndefinedOutputFormat.- Specified by:
isOutputFormatMixingAllowedin classOutputFormat
-
getName
public java.lang.String getName()
Description copied from class:OutputFormatThe short name used to refer to this format (like in the#ftlheader).- Specified by:
getNamein classOutputFormat
-
getMimeType
public java.lang.String getMimeType()
Description copied from class:OutputFormatReturns the MIME type of the output format. This might comes handy when generating a HTTP response.nullnullif this output format doesn't clearly corresponds to a specific MIME type.- Specified by:
getMimeTypein classOutputFormat
-
-