Package freemarker.core
Class OutputFormat
- java.lang.Object
-
- freemarker.core.OutputFormat
-
- Direct Known Subclasses:
CSSOutputFormat,JavaScriptOutputFormat,JSONOutputFormat,MarkupOutputFormat,PlainTextOutputFormat,UndefinedOutputFormat
public abstract class OutputFormat extends java.lang.ObjectRepresents an output format. If you need auto-escaping, see its subclass,MarkupOutputFormat.
-
-
Constructor Summary
Constructors Constructor Description OutputFormat()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract java.lang.StringgetMimeType()Returns the MIME type of the output format.abstract java.lang.StringgetName()The short name used to refer to this format (like in the#ftlheader).abstract booleanisOutputFormatMixingAllowed()Tells if this output format allows insertingTemplateMarkupOutputModel-s of another output formats into it.java.lang.StringtoString()Returns the short description of this format, to be used in error messages.protected java.lang.StringtoStringExtraProperties()Should be like"foo=\"something\", bar=123"; this will be inserted inside the parentheses intoString().
-
-
-
Method Detail
-
getName
public abstract java.lang.String getName()
The short name used to refer to this format (like in the#ftlheader).
-
getMimeType
public abstract java.lang.String getMimeType()
Returns 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.
-
isOutputFormatMixingAllowed
public abstract boolean isOutputFormatMixingAllowed()
Tells 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.
-
toString
public final java.lang.String toString()
Returns the short description of this format, to be used in error messages. OverridetoStringExtraProperties()to customize this.- Overrides:
toStringin classjava.lang.Object
-
toStringExtraProperties
protected java.lang.String toStringExtraProperties()
Should be like"foo=\"something\", bar=123"; this will be inserted inside the parentheses intoString(). Shouldn't returnnull; should return""if there are no extra properties.
-
-