Writes raw bytes to the response under a caller-chosen content type, from either a byte array or an input stream. Created via ViewsBuilder.binaryView(...) from server-side JS and returned from a controller as the view for a request. The stream form is streamed to the response and the stream is closed afterwards, so it can only be rendered once; the byte array form is written in a single call and so holds the whole payload in memory. Any byte range on the request is ignored - the full content is always 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, always "Binary data".

Methods

getDescription()

Returns: String

Short, user-facing label for this view, always "Binary data".

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

Returns: void

Writes the view's bytes to the response. A byte array is written in one call; an input stream is copied to the response and then closed, with a warning logged if closing it fails.

ParameterDescription
pagethe resource the view is being rendered for, not used by this view
outthe stream the bytes are written to
rangenot used by this view; the full content is always 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, sent as the response's content type.

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