Package com.englishtown.vertx.jersey

Examples of com.englishtown.vertx.jersey.WriteStreamOutput


        // Return output stream based on whether entity is chunked
        if (responseContext.isChunked()) {
            response.setChunked(true);
            return new VertxChunkedOutputStream(response);
        } else if (responseContext.hasEntity() && WriteStreamOutput.class.isAssignableFrom(responseContext.getEntityClass())) {
            WriteStreamOutput writeStreamOutput = (WriteStreamOutput) responseContext.getEntity();
            writeStreamOutput.init(response, new Handler<Void>() {
                @Override
                public void handle(Void event) {
                    end();
                }
            });
View Full Code Here


    @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

        // Return output stream based on whether entity is chunked
        if (responseContext.isChunked()) {
            response.setChunked(true);
            return new VertxChunkedOutputStream(response);
        } else if (responseContext.hasEntity() && WriteStreamOutput.class.isAssignableFrom(responseContext.getEntityClass())) {
            WriteStreamOutput writeStreamOutput = (WriteStreamOutput) responseContext.getEntity();
            writeStreamOutput.init(response, event -> {
                end();
            });
            isWriteStream = true;
            return new NOPOutputStream();
        } else {
View Full Code Here

TOP

Related Classes of com.englishtown.vertx.jersey.WriteStreamOutput

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.