@Produces(MediaType.TEXT_PLAIN)
public void getStream(
@Context final Vertx vertx,
@Suspended final AsyncResponse asyncResponse) {
final WriteStreamOutput writeStreamOutput = new DefaultWriteStreamOutput();
final Buffer buffer1 = Buffer.buffer().appendString("abcdefghijklmnopqrstuvwxyz");
final Buffer buffer2 = Buffer.buffer().appendString("0123456789");
int length = buffer1.length() + buffer2.length();
asyncResponse.resume(Response
.ok(writeStreamOutput)
.header(HttpHeaders.CONTENT_LENGTH, length)
.build());
vertx.runOnContext(aVoid1 -> {
writeStreamOutput.write(buffer1);
vertx.runOnContext(aVoid2 -> {
writeStreamOutput.write(buffer2);
writeStreamOutput.end();
});
});
}