Package com.englishtown.vertx.jersey.impl

Examples of com.englishtown.vertx.jersey.impl.DefaultWriteStreamOutput


    @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();
            });
        });
    }
View Full Code Here

TOP

Related Classes of com.englishtown.vertx.jersey.impl.DefaultWriteStreamOutput

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.