Build a new object of this class, specifying template and also output content type
(MIME type). Most of the times this will force a template mode for template execution
(e.g.
text/html,
application/javascript), but not always (e.g.
text/event-stream).
The template normally represents the template name, but can be the entire template
contents if the template is meant to be specified as a String and resolved by a
org.thymeleaf.templateresolver.StringTemplateResolver.
Supported relations between template mode and output content type are:
- HTML:
text/html,
application/xhtml+xml
- XML:
application/xml
- JAVASCRIPT:
application/javascript,
application/x-javascript,
application/ecmascript,
text/javascript,
text/ecmascript,
application/json
- CSS:
text/css
- TEXT:
text/plain
The
text/event-stream content type will also be supported, but will have no effect in
forcing a template mode. Instead, it will put the engine into Server-Sent Event (SSE) output mode.
Note content type parameters will be ignored (only the mime type itself will be used).
This constructor will set no template selectors or template resolution attributes.