Renders a fixed string of text as the response body, with an optional content type. Created via ViewsBuilder.textView(...) from server-side JS as a simple way to return literal text. Defaults to text/plain when no content type is given, and supports partial output through a byte-offset range.

Group: Views

Implements: View, Serializable


Properties

PropertyReturnsDescription
contentTypeStringThe content type supplied at construction, or "text/plain" if none was given.

Methods

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

Returns: void

Writes the text to the response, restricted to the requested byte range if any.

ParameterDescription
pagethe resource the view is being rendered for, not used by this view
outthe stream the text is written to
rangeif given, only the bytes within this range are written
paramsrequest parameters, not used by this view
contentTypenot used by this view; getContentType() supplies the response content type

getContentType()

Returns: String

The content type supplied at construction, or "text/plain" if none was given.

toRange(String text, Range range)

Returns: String

Extracts the substring of the text falling within the given byte range, or the whole text if no range is given.

ParameterDescription
textthe full text
rangethe byte range to extract, or null to return the whole text
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.