public interface

StreamingResponse

com.atlassian.bitbucket.rest.util.StreamingResponse

Class Overview

Allows streaming a response directly, similar to StreamingOutput. Unlike StreamingOutput, though, StreamingResponse allows HTTP headers to be set prior to streaming. Setting headers in write(MultivaluedMap, OutputStream) instead of on the Response wrapping this StreamingResponse, allows setting headers only if the operations leading up to streaming bytes actually succeed.

Note that, if just-in-time headers are not needed, it's preferable to use the standard StreamingOutput interface instead.

Summary

Public Methods
void write(MultivaluedMap<String, Object> httpHeaders, OutputStream outputStream)
Writes the entity payload to the response, optionally setting additional HTTP headers first.

Public Methods

public void write (MultivaluedMap<String, Object> httpHeaders, OutputStream outputStream)

Writes the entity payload to the response, optionally setting additional HTTP headers first.

Additional headers must be set before the first byte is written to the provided OutputStream. When the first byte is written pending headers are flushed, and any subsequent headers will be ignored.

Parameters
httpHeaders a mutable map of HTTP headers, allowing new headers to be set (HTTP headers can only be set prior to writing any bytes to the provided OutputStream.)
outputStream the stream to write the entity payload to
Throws
IOException if the entity cannot be written to the stream
WebApplicationException if an unexpected error occurs and the overall Response should be changed (The response can only be changed if this exception is thrown prior to writing any bytes to the provided OutputStream.)