Renders a Velocity template as plain text under a caller-chosen content type, for output such as CSV, XML, JSON or an email body. Created via ViewsBuilder.textTemplateView(...) from server-side JS and returned from a controller as the view for a request. Rendering is delegated to TextTemplater rather than the HTML templater, so none of the page chrome a theme adds is applied. The content type is whatever was passed in, and any byte range on the request is ignored - the whole output is written.

Group: Views

Implements: View


Properties

PropertyReturnsDescription
contentTypeStringThe content type supplied at construction, sent as the response's content type.
descriptionStringShort, user-facing label for this view, naming the template path it renders and the content type it sends.
templateStringThe path of the text template this view renders, as supplied at construction.

Methods

getDescription()

Returns: String

Short, user-facing label for this view, naming the template path it renders and the content type it sends.

render(CommonResource page, OutputStream out, Range range, Map<String,String> params, String contentType)

Returns: void

Renders the template to the response through TextTemplater, with the given resource as the page model.

ParameterDescription
pagethe resource the view is being rendered for, passed to the templater as the page model
outthe stream the rendered text is written to
rangenot used by this view; the whole output is always written
paramsrequest parameters, made available to the template
contentTypenot used by this view; getContentType() supplies the response content type

getContentType()

Returns: String

The content type supplied at construction, sent as the response's content type.

getTemplate()

Returns: String

The path of the text template this view renders, as supplied at construction.

To get full access to the Kademi Hub existing customers can login here, or new customers can register here.