StreamResource (TODO)

The oaj.http.StreamResource class is the binary equivalent to the ReaderResource object. In essence, it's a container for binary data with optional response headers.

The class is annotated with {@link oaj.http.annotation.Response @Response} which allows it to be returned as responses by REST methods.

Example:

@RestMethod(...) public Object showPicture(RestRequest req) { // Return a stream resource loaded from a file. return StreamResource.create() .contents(new File("mypicture.png")) .header("Cache-Control", "no-cache") .mediaType(IMAGE_PNG) .build(); }