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
| Property | Returns | Description |
|---|---|---|
| contentType | String | The 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.
| Parameter | Description |
|---|---|
page | the resource the view is being rendered for, not used by this view |
out | the stream the text is written to |
range | if given, only the bytes within this range are written |
params | request parameters, not used by this view |
contentType | not 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.
| Parameter | Description |
|---|---|
text | the full text |
range | the 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.